tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Purvis Robert (NHS CONNECTING FOR HEALTH)" <robert.pur...@nhs.net>
Subject RE: Sending email ( Tomcat 7 )
Date Wed, 18 Jan 2012 09:03:38 GMT
java.util.Properties p = new Properties();
javax.mail.Session s = javax.mail.Session.getInstance(p);
javax.mail.internet.MimeMessage message = new javax.mail.internet.MimeMessage(s);
try {
   javax.mail.internet.InternetAddress from = new javax.mail.internet.InternetAddress(emailFrom,
emailFrom);
   message.setFrom(from);
   message.addRecipient(javax.mail.Message.RecipientType.TO, new javax.mail.internet.InternetAddress(emailTo));
   message.addRecipient(javax.mail.Message.RecipientType.CC, new javax.mail.internet.InternetAddress(emailCc));
   message.addRecipient(javax.mail.Message.RecipientType.BCC, new javax.mail.internet.InternetAddress(emailBccList));
   message.setSubject(emailSubject);
   message.setText(emailBody);
   javax.mail.Transport.send(message);
} catch (Exception e) {
   System.out.println("Email failure: " + e.toString());
}



Robert Purvis


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: 18 January 2012 07:28
To: Tomcat Users List
Subject: RE: Sending email ( Tomcat 7 )

> From: Lau Eng Huat [mailto:tomcathelp@gmail.com]
> Subject: Sending email ( Tomcat 7 )

> I need to send emails using tomcat servlet.

First, read the docs:

http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JavaMail_Sessions

If that isn't sufficient, come back and ask specific questions.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please
inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in
reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and
Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail
and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere
For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message