How to send Mail in JSP
Hi,
I am newbee in Java, I want to send mail to different accounts using java from my website. Plz help me with working example. I am new to java.
Thanks in advance,
devom
Thanks, but I want to send mail from my WEb page that is in JSP. The arcticle pointed out sends mail in core java. I already know how to send in Core java, but i want to send through JSP. Plz help me.
Thanks in advance,
Devom
Similar Messages
-
How to send mail using jsp program
am very new to jsp and doing my final year project. i need to send mails using my jsp program.can anyone say wht to do that is wht to include to send mails using jsp program. n also a sample code to send mail using jsp program.
Thanx in advanceUse below script.
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", "mailserver.com");
Session s = Session.getInstance(props,null);
InternetAddress from = new InternetAddress("[email protected]");
InternetAddress to = new InternetAddress([email protected]");
MimeMessage message = new MimeMessage(s);
message.setFrom(from);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("Your subject");
message.setText("Your text");
Transport.send(message);
%>{code} -
hi,
i want to send mail from my jsp page.
1) how can i do this
2) do i need any mail server for doin this
thanks
regards
manoji want to send mail from my jsp page.
1) how can i do this
2) do i need any mail server for doin thisRead
http://java.sun.com/developer/onlineTraining/JavaMail/
Rather,
try this:
http://jakarta.apache.org/taglibs/doc/mailer-doc/mailer-1.1/index.html -
How to send mail from jsp pageq
Pls help me with this topic
Thanks alotCan you make it clearer. Pls give me a sample code if possible
Thanks alot -
How to send mail in html format in jsp???
Hello everybody,
I have two jsp pages.In one page I have the heading like Date,Transaction.I am retriving data from my second jsp page.And I hae included the second jsp page to my first jsp page.How to send mail this content in html format.
Thanks
SrikantMimeMessage m = new MimeMessage(session);
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/html");this if u need to send a mail content as html -
Need to Send Mail from JSP...
Dear Team,
I Need to Send Mail from JSP, have Designed user Interface to enter
to, from, subject, and message text .
Have Downloaded mail.jar and activate.jar file..... and placed in tomcat lib directory and WEBAPPS/WEB-INF/lib Directory too
How do i send a mail to user ?
do I require something else apart from things that i have mentioned?
do i have to Configure SMTP, POP3 or Something like this....
Now If I Create a object of Type MimeMessage and Set Recipient, from, subject and if i say transport.send(message) will this do My JOB???Dear Team,
I Need to Send Mail from JSP, have Designed user
Interface to enter
to, from, subject, and message text .
Have Downloaded mail.jar and activate.jar file.....
and placed in tomcat lib directory and
d WEBAPPS/WEB-INF/lib Directory too
How do i send a mail to user ?
do I require something else apart from things that i
have mentioned?
do i have to Configure SMTP, POP3 or Something like
this....
Now If I Create a object of Type MimeMessage and Set
Recipient, from, subject and if i say
transport.send(message) will this do My JOB???Yup! in addition to all the above i need to know my mail box outgoing mail server. and that's enough...... i am able to do that.
Regards,
Jagadeesh HS. -
How to send mail to distribution list ?
Hi Everybody,
Pls let me know how to send mail to distributed list???
Thanks & Regards,
raju<b></b>Hi ,
Use Function Module 'SO_NEW_DOCUMENT_SEND_API1'.
U need to pass Distribution list to Receiver and 'C' to receiver type refer the below code for clarification.
Determine the Distribution List.
gv_rec_list-receiver = gv_distribution.
gv_rec_list-rec_type = 'C'.
APPEND gv_rec_list.
Check if Distribution List is deleted.
SELECT SINGLE objnam
FROM soid
INTO lc_objnam
WHERE objnam = gv_rec_list AND
dlitp = lc_dli.
IF sy-subrc = 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = gv_doc_data
document_type = 'RAW'
put_in_outbox = 'X'
TABLES
object_content = gv_obj_cont
receivers = gv_rec_list
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4.
CASE sy-subrc.
WHEN '1'.
message i001(as) with 'TOO MANY RECEIVERS'.
EXIT.
WHEN '2'.
message i001(as) with 'DOCUMENT NOT SENT'.
EXIT.
WHEN '3'.
message i001(as) with 'DOCUMENT TYPE DOES NOT EXIST'.
EXIT.
WHEN '4'.
message i001(as) with 'OPERATION NO AUTHORIZATION'.
EXIT.
ENDCASE.
Hope this might have helped you.
Thanks,
Prashanth -
How can send mails using hotmail/rediffmail domain name?
I have used the below code to send a mail using javamail API?Even when I am sending my application does not have notified any of error/exceptions,But the message is not reached to I have given receipient's address in the to field.
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Sendmail1 extends HttpServlet {
private String smtpHost;
// Initialize the servlet with the hostname of the SMTP server
// we'll be using the send the messages
public void init(ServletConfig config)
throws ServletException {
super.init(config);
smtpHost = config.getInitParameter("smtpHost");
//smtpHost = "sbm5501";
smtpHost = "www.rediffmail.com";
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, java.io.IOException {
String from = request.getParameter("from");
String to "[email protected]";
String cc = "[email protected]";
String bcc ="[email protected]";
String smtp ="www.rediffmail.com";
String subject = "hai";
String text = "Hai how r u";
PrintWriter writer = response.getWriter();
if (subject == null)
subject = "Null";
if (text == null)
text = "No message";
String status;
try {
// Create the JavaMail session
java.util.Properties properties = System.getProperties();
if (smtp == null)
smtp = "www.rediffmail.com";
properties.put("mail.smtp.host", smtp);
Session session = Session.getInstance(properties, null);
//to connect
//Transport transport =session.getTransport("smtp");
//transport.connect(smtpHost,user,password);
// Construct the message
MimeMessage message = new MimeMessage(session);
// Set the from address
Address fromAddress = new InternetAddress(from);
message.setFrom(fromAddress);
// Parse and set the recipient addresses
Address[] toAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.TO,toAddresses);
Address[] ccAddresses = InternetAddress.parse(cc);
message.setRecipients(Message.RecipientType.CC,ccAddresses);
Address[] bccAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.BCC,bccAddresses);
// Set the subject and text
message.setSubject(subject);
message.setText(text);
Transport.send(message);
//status = "<h1>Congratulations,</h1><h2>Your message was sent.</h2>";
} catch (AddressException e)
status = "There was an error parsing the addresses. " + e;
} catch (SendFailedException e)
status = "<h1>Sorry,</h1><h2>There was an error sending the message.</h2>" + e;
} catch (MessagingException e)
status = "There was an unexpected error. " + e;
// Output a status message
response.setContentType("text/html");
writer.println("<title>sendForm</title><body bgcolor= ><b><h3><font color=green><CENTER>CALIBERINFO.COM</CENTER></h3>Your message was sent to recepient(s).<br><font color=red>"+"\n"+to);
writer.println("<br><br><a href=e:/mail/javamail/mail.html>back to compose</a>");
writer.close();
Please any one help me out from this probs.
Awaiting for yours reply,
or give me a reply to: [email protected]
Regards,
@maheshkumar.kHi,
how can send mails using hotmail/rediffmail domain name?In your java application,you specified www.rediffmail.com as your
smtp server.But that is the address of that website.Try will a smtp
server instead.For a list of free smtp servers,please visit http://www.thebestfree.net/free/freesmtp.htm
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/ -
How to send mail with attachment
Hi,
How to send mail with word document as attachment in oracle pl/sql.
kindly help me .
thank you
regards
P Prakashcreate or replace procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me <[email protected]>'
p_recipients varchar2, -- recipients, example: 'Someone <[email protected]>'
p_subject varchar2, -- subject
p_text varchar2, -- text
p_filename varchar2, -- name of pdf file
p_blob blob -- pdf file
) is
conn utl_smtp.connection;
i number;
len number;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => p_filename,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
demo_mail.end_attachment(conn => conn);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
demo_mail.end_mail( conn => conn );
END;
ref:
http://www.plpdf.com/23-1725.html
Edited by: Mahanam on Jan 9, 2011 10:32 PM -
How to send mail in APEX 4.1 using PLSQL
Hi All,
How to send mail in APEX 4.1 using PLSQL?
Thanks In advance.
Regards
Shailhttp://lmgtfy.com/?q=oracle+apex+4.1+send+mail
-
How to Send mail in oracle 10g
I am new in oracle developer.....we are using oracle 10g developer...how to send mail through oracle 10g on a button click.pease help me.
Thanks in advanceThis question have been asked many times on this forum, see if you get help from following:
https://forums.oracle.com/message/5395438#5395438
Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email
Check this out as well:
http://nzchaudhry.wordpress.com/2013/05/31/send-report-via-email-attachment-in-oracle-forms-10g/
You can find init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and on Windows under $ORACLE_HOME/database. Otherwise you can create it using "create pfile from spfile" command
Aneel -
This is query from shanmugam
Thanks, but I want to send mail from my WEb page that is in JSP. The arcticle pointed out sends mail in core java. I already know how to send in Core java, but i want to send through JSP. Plz help me.
Thanks in advance,
Devom -
How to send info from JSP page as email-body
Hi,
i have a JSP page that generates dynamically as a result of some query. I have a Button - "Send Email".
I want to send the information to the receipient thru email automatically on a button click,
All information is in the memory. How can we pick the info from memory and send it as a message thru email?
Pls help.
thanx & regards,
Shalinicreate a servlet to send mail (use the JavaMail api) then Post the message to the servlet when you click on the button.
OR, put the message and any other data (like the email address) into the session, and then just call the servlet on click of the button, and have the servlet retrieve the information from the session. -
How to send mail from servlets
m having troubles sending mail from servlets...
how do you use the SimpleMailUser object needed in the session?
a sample code on this would be of great help, thanks!<html>
<body bgcolor="white">
<font size=5 color="black">
<%@ page import="javax.servlet.http.HttpUtils" %>
<%@ page import="java.util.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.io.*" %>
<%@ page import= "sun.net.smtp.SmtpClient" %>
<%
String from,to,subject,msgbody,serverName;
try
from = request.getParameterValues("from")[0];
to = request.getParameterValues("to")[0];
subject = request.getParameterValues("subject")[0];
msgbody = request.getParameterValues("msgbody")[0];
serverName = request.getParameterValues("server")[0];
catch (Exception e) // Generally Speaking, an Error getting one of these
// Values means that it wasnt passed in; inform the user
out.println("You must call this JSP from this ");
out.println("<A href=\"FormMail.htm\"> form</A>.<BR>");
out.flush();return;
%>
Hold On A Moment while I try to Send Your Mail... <BR>
<%
out.flush();
// Here are the real guts of the mail sending
try
sun.net.smtp.SmtpClient sm = new sun.net.smtp.SmtpClient(serverName);
sm.from(from);
sm.to(to);
PrintStream msg = sm.startMessage();
msg.println("To: "); // Note dont use + for Performance
msg.println(to);
msg.println("Subject: ");
msg.println(subject);
msg.println();
msg.println(msgbody);
msg.println("==============");
msg.print("This mail brought to you by JSP MAIL..from a user at IP ");
msg.println(request.getRemoteHost());
sm.closeServer();
out.println("Your Mail Has Been Sent!");
catch (Exception e)
out.println("The mail couldn't be sent, probably because the mailhost wasnt set correctly.<BR> ");
out.println("The error message I am getting is: ");
out.println(e.getMessage());
%>
<BR>
<BR>
Click here to send another! -
How to send emails using JSP?
How can i send emails using JSP? what are the things that i will need? please help me asap...thanks
Hi,
This works for me:
<%
String from = "Person"
String to= "my-email-address;
try{
SmtpClient client = new SmtpClient("smtp.stuff.com");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending an e-mail");
message.println();
message.println("Groovy :-)");
client.closeServer();
catch (IOException e){
System.out.println("ERROR SENDING EMAIL: "+e);
%>
Maybe you are looking for
-
HOW to get Windows 7 installed on HP Pavilion 15 15-E028US 15-E1X73UA E1X73UA / E028US
Im just posting this to save the agony i went through trying to find correct windows 7 64 Bit drivers. hopefully this will save many people time since alot of people downgrade from windows 8 to windows 7. This is how i got Windows 7 installed on the
-
Business System doesn't exist in the SLD
Hi, Im trying to import XI content into the Integration directory. when i logged into Integration directory I clicked <i>Tools -> Import Configuration Objects</i>. Im getting a dialog window saying "Business System <Business system name> does
-
I have the 60GB iPod. Purchased the Xillisoft DVD to iPod Converter 4. I used all of the "preset" settings, only changes were "checked" the box for Audio/Video Synch. under Properties. The converter did a fine job but the iPod plays the video and aft
-
Airport extreme does not appear in airport utility and will not reset
Hi, Here's the problem: My base station wasn't letting me reconfigure its settings via ethernet or airport. I unplugged all cables and performed a hard reset. Now, it will not appear in airport utility either on ethernet or wireless, and it will not
-
Is it possible to assign MIDI control to change tempo?
I would like to be able to change tempo (say, from 120 to 180 bpm) by using a fader from a MIDI keyboard (Edirol PCR-30). I can assign MIDI commands to Logic's buttons, volume, pan... but I can't figure how to do it with tempo. Any help would be appr