Thursday, January 24, 2013

Using Amazon SES to send emails

Amazon SES provides a easy way to send emails from your application. The strongest point of using SES is that it reduces the likelihood that your emails will be marked as spams by your ISPs.

You will need your AWS Access Keys and the SMTP Credentials.


Getting your AWS Access Keys

If you want to send email directly by using the Amazon SES API or the AWS SDK, you will need to use these keys.

In the AWS console, click on My Account/Console -> Security Credentials.

Obtain your access key id and the secret access key. (Scroll to the section called Access Credentials).


Getting the SMTP Credentials

Go to the Amazon SES console.

Click Create My SMTP Credentials.

Enter a new name for the IAM user or just use the default. Click Create.

Make sure you download the credentials or record it somewhere. You will NOT be able to see this again.


Testing Email Sending

In the SES console, click Verified Senders on the left sidebar.

Add a few email addresses by clicking on Verify a New Email Address.

Test sending a few emails and make sure you get them. Both senders and receivers need to be verified.


Request Production Access

Click in the form below. Usually, this process takes a day. It's better to request as early as possible.

https://portal.aws.amazon.com/gp/aws/html-forms-controller/contactus/SESProductionAccess2011Q3


Configuring your SMTP settings in your application

In the SES console, click SMTP Settings on the left sidebar.

You will need to configure your application with the following settings (also the SMTP credentials we set up above).

Server Name:email-smtp.us-east-1.amazonaws.com
Port:25, 465 or 587
Use Transport Layer Security (TLS):Yes
Authentication:Your SMTP credentials - see below.


For my set up, I use Spring's email provider and configure my provider with the above settings.

That's it. Test sending your emails through emails.

If you want to directly access the Amazon SES API, look at Using the Amazon SES API to Send Email.

1 comment:

  1. This doesn't exactly explain how to setup tomcat with the correct settings. Any other insights here? (got here from http://developer24hours.blogspot.ca/2013/01/setting-up-java-tomcat7-production.html)

    ReplyDelete