Email Notifications with Amazon SES

by Sebastien Mirolo on Tue, 5 Aug 2014

Today we are setting up email notification for the Django webapp through Amazon SES, not to be confused with Amazon SNS (Simple Notification Service) and Amazon SQS (Simple Queue Service) which are other useful notification services from Amazon.

There really does not seem much reason to set Amazon SES up more than once so we will do the setup through the AWS Console this time around.

Verify Sender Email Addresses

First is to verify the From email address for messages generated by the EC2 instances. We will also verify a To email address we are using while testing.

This is done by a classic, enter an email address in the console, receive an email with a validation URL and click on it, workflow.

Update SPF Record

We add in the list of valid origins for our domain name by setting the SPF record at the DNS provider. Ex:

"v=spf1 a mx -all"

Getting SMTP Credentials

Through the console, we obtain the Amazon SES SMTP credentials necessary and write them down in the Django settings. A side note here, the SMTP credentials are created for an IAM user. That's pretty cool how you can authorize and restrict what this "sender" user can do through regular IAM policies.

$ diff -u prev /etc/django/site.conf

$ diff -u prev /etc/django/credentials

$ sudo service django restart


Here we try to register a new user into the web application. This will trigger an email.

If nothing shows up in the mailbox, either one or both of the From and To email addresses where not verified. If the email shows up as spam, the SPF record might be incorrect.

Request for Production Access

Last step is to request production access such that the application can send emails to addresses that where obviously not verified with Amazon SES previously.

Et Voila!

by Sebastien Mirolo on Tue, 5 Aug 2014

Receive news about DjaoDjin in your inbox.

Bring fully-featured SaaS products to production faster.

Follow us on