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:[email protected]]
Sent: 18 January 2012 07:28
To: Tomcat Users List
Subject: RE: Sending email ( Tomcat 7 )
> From: Lau Eng Huat [mailto:[email protected]]
> 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: [email protected]
For additional commands, e-mail: [email protected]
********************************************************************************************************************
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: [email protected]
For additional commands, e-mail: [email protected]