Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

SV: SV: Tomcat config

Søren Blidorf

2004-01-17

Replies:

Hi Humayun

You can look at this for ideas:

http://www.javacommerce.com/articles/SendMailUsingAuthentication.java

Soren


-----Oprindelig meddelelse-----
Fra: S M Humayun [mailto:humayun_reports@(protected)]
Sendt: 17. januar 2004 13:48
Til: Tomcat Users List
Emne: Re: SV: Tomcat config

Thanks Soren,

The example is very helpful, but what if my smtp server asks me to pass
my username and password also ?

thanks again,

Humayun.

Søren_Blidorf <soren@(protected):
I don't know if this is what you mean, but this jsp page sends mails
with javaMail.

BR

Soren


javax.mail.internet.*, java.util.*, java.lang.String" %>


Properties props = new Properties();
props.put("mail.smtp.host", "YOUR SMTP");
Session s = Session.getInstance(props);

MimeMessage message = new MimeMessage(s);

String mail;

mail = request.getParameter("mail");
InternetAddress from = new InternetAddress(mail);
message.setFrom(from);
InternetAddress to = new InternetAddress("info@(protected) ");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject(request.getParameter("subject"));
message.setText("Mail from "+request.getParameter("name")+"
"+request.getParameter("text"));

Transport transport = s.getTransport("smtp");

transport.connect();
transport.send(message);
transport.close();

%>

-----Oprindelig meddelelse-----
Fra: S M Humayun [mailto:humayun_reports@(protected)]
Sendt: 17. januar 2004 13:34
Til: tomcat-user@(protected)
Emne: Tomcat config

Hi all,

Can some one please tell me how to make my JSP's use JavaMail to send
emails from my domain, say www.abc.com ? please mention step by step
process which files to edit and where to edit ? I have a private JVM
account therefore I am viewing complete Tomcat directory.

Thanks in advance,

Humayun.


Syed Muhammad Humayun
Web Developer
Al Ghanem Net LLC



---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


Syed Muhammad Humayun
Web Developer
Al Ghanem Net LLC



---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.