Skip to main content

A Django email backend for Amazon's Simple Email Service

Project description

Info:A Django email backend for Amazon’s Simple Email Service
Author: Harry Marr (http://github.com/hmarr, http://twitter.com/harrymarr)

A bird’s eye view

Django-SES is a drop-in mail backend for Django. Instead of sending emails through a traditional SMTP mail server, Django-SES routes email through Amazon Web Services’ excellent Simple Email Service (SES).

Why SES instead of SMTP?

Configuring, maintaining, and dealing with some complicated edge cases can be time-consuming. Sending emails with Django-SES might be attractive to you if:

  • You don’t want to maintain mail servers.
  • You are already deployed on EC2 (In-bound traffic to SES is free from EC2 instances).
  • You need to send a high volume of email.
  • You don’t want to have to worry about PTR records, Reverse DNS, email whitelist/blacklist services.
  • Django-SES is a truely drop-in replacement for the default mail backend. Your code should require no changes.

Getting going

Assuming you’ve got Django installed, you’ll need Boto 2.0b4 or higher. Boto is a Python library that wraps the AWS API.

You can do the following to install boto 2.0b4 (we’re using –upgrade here to make sure you get 2.0b4):

pip install --upgrade boto

Install django-ses:

pip install django-ses

Add the following to your settings.py:

EMAIL_BACKEND = 'django_ses.SESBackend'

# These are optional -- if they're set as environment variables they won't
# need to be set here as well
AWS_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID'
AWS_SECRET_ACCESS_KEY = 'YOUR-SECRET-ACCESS-KEY'

Now, when you use django.core.mail.send_mail, Simple Email Service will send the messages by default.

Check out the example directory for more information.

SES Stats Report

A very simple read-only report on your quota, verified email addresses and sending statistics is included.

If you wish to use the SES sending statistics reports, you must include django_ses in your INSTALLED_APPS and you must include django_ses.urls in your urls.py.

Django Builtin-in Error Emails

If you’d like Django’s Builtin Email Error Reporting to function properly (actually send working emails), you’ll have to explicitly set the SERVER_EMAIL setting to one of your SES-verified addresses. Otherwise, your error emails will all fail and you’ll be blissfully unaware of a problem.

Note: You will need to sign up for SES and verify any emails you’re going to use in the from_email argument to django.core.mail.send_email(). Boto has a verify_email_address() method: https://github.com/boto/boto/blob/master/boto/ses/connection.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-ses, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_ses-0.1-py2.6.egg (9.6 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size django-ses-0.1.tar.gz (9.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page