It’s amazing to see that a product that Amazon announces has ready-to-use python code overnight. Getting setup to send email using Amazon’s Simple Email Service is a breeze using Harry Marr’s [1] boto and Django-SES packages available on github [2][3].
Using SES directly in python is a matter of instantiating an SESConnection and calling send_email:
from boto.ses import SESConnection
source = "from@example.com"
subject = "hello SES!"
body = "email message from python!"
to_addresses = ["to@example.com"]
connection = SESConnection(aws_access_key_id=<your id>, aws_secret_access_key=<your key>)
connection.send_email(source, subject, body, to_addresses)
Integrating it into django is pretty trivial, just add to settings.py:
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_ACCESS_KEY_ID = <your id>
AWS_SECRET_ACCESS_KEY = <your key>
Once that’s in your settings, your application doesn’t have to change at all to send via SES.
The downside: SES does not handle attachments, period. You can only send text or HTML-formatted emails. If you need to send files, you’re out of luck for now.
Resources:
[1] http://hmarr.com/2011/jan/26/using-amazons-simple-email-service-ses-with-django/
[2] https://github.com/hmarr/boto
[3] https://github.com/hmarr/django-ses