commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <>
Subject [Email] Using Amazon Simple Email Service SES
Date Wed, 16 Feb 2011 04:47:22 GMT
Has anyone been able to use this service with commons email?  I can't seem
to wrap my head around how to do it.

Here here is bit of their sample code....

              PropertiesCredentials credentials = new PropertiesCredentials(

Properties props = new Properties();

         * Setup JavaMail to use the Amazon Simple Email Service by
        * specifying the "aws" protocol.
props.setProperty("mail.transport.protocol", "aws");

 * Setting and are optional. Setting
 * these will allow you to send mail using the static transport send()
 * convince method.  It will also allow you to call connect() with no
 * parameters. Otherwise, a user name and password must be specified
 * in connect.
props.setProperty("", credentials.getAWSAccessKeyId());
 props.setProperty("", credentials.getAWSSecretKey());

Session session = Session.getInstance(props);

try {
// Create a new Message
Message msg = new MimeMessage(session);
 msg.setFrom(new InternetAddress(FROM));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(TO));

// Reuse one Transport object for sending all your messages
// for better performance
 Transport t = new AWSJavaMailTransport(session, null);
t.sendMessage(msg, null);

// Close your transport when you're completely done sending
// all your messages


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message