A Django email backend for Amazon's Simple Email Service
This is a minified fork of Harry Marr’s django-ses
pip install --upgrade boto
pip install django-ses-backend
Add the following to your settings.py:
EMAIL_BACKEND = 'django_ses_backend.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' # Additionally, you can specify an optional region, like so: AWS_SES_REGION_NAME = 'us-east-1' AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com'
Alternatively, instead of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, you can include the following two settings values. This is useful in situations where you would like to use a separate access key to send emails via SES than you would to upload files via S3:
AWS_SES_ACCESS_KEY_ID = 'YOUR-ACCESS-KEY-ID' AWS_SES_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.
Since SES imposes a rate limit and will reject emails after the limit has been reached, django-ses will attempt to conform to the rate limit by querying the API for your current limit and then sending no more than that number of messages in a two-second period (which is half of the rate limit, just to be sure to stay clear of the limit). This is controlled by the following setting:
AWS_SES_AUTO_THROTTLE = 0.5 # (default; safety factor applied to rate limit)
To turn off automatic throttling, set this to None.
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
If you’d like to fix a bug, add a feature, etc
To run the tests:
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|django_ses_backend-0.1.1-py2.py3-none-any.whl (10.8 kB) Copy SHA256 Checksum SHA256||3.4||Wheel||Aug 1, 2014|
|django-ses-backend-0.1.1.tar.gz (7.0 kB) Copy SHA256 Checksum SHA256||–||Source||Aug 1, 2014|