c0b71c406087b6812d61256b65a2500ddfd58648
Django AWS SES
A Django email backend for sending emails via Amazon Simple Email Service (SES).
Features
- Send emails using AWS SES with DKIM signing support.
- Handle bounce, complaint, and delivery notifications via SNS webhooks.
- Filter recipients based on bounce/complaint history and domain validation.
- Admin dashboard for SES statistics and verified emails.
- Unsubscribe functionality with secure URL generation.
Installation
pip install django_aws_ses
Requirements
- Python 3.8+
- Django 3.2+
- AWS SES account with verified domains/emails
Setup
-
Add to
INSTALLED_APPS:INSTALLED_APPS = [ ... 'django_aws_ses', ] -
Configure settings in
settings.py:AWS_SES_ACCESS_KEY_ID = 'your-access-key' AWS_SES_SECRET_ACCESS_KEY = 'your-secret-key' AWS_SES_REGION_NAME = 'us-east-1' AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com' EMAIL_BACKEND = 'django_aws_ses.backends.SESBackend' -
Apply migrations:
python manage.py migrate -
(Optional) Enable DKIM signing:
DKIM_DOMAIN = 'example.com' DKIM_PRIVATE_KEY = 'your-private-key' DKIM_SELECTOR = 'ses' -
Set up SNS webhook for bounce/complaint handling:
- Add the URL
your-domain.com/aws_ses/bounce/to your SNS subscription. - Ensure the view is accessible (e.g., CSRF-exempt).
- Add the URL
Usage
- Send emails using Django’s
send_mailorEmailMessage. - View SES statistics at
/aws_ses/status/(superuser only). - Unsubscribe users via
/aws_ses/unsubscribe/<uuid>/<hash>/.
Development
To contribute:
- Clone the repo:
git clone https://github.com/zeeksgeeks/django_aws_ses - Install dependencies:
pip install -r requirements.txt - Run tests:
python manage.py test
License
MIT License. See LICENSE for details.
Credits
Developed by Ray Jessop. Inspired by django-ses.
Languages
Python
89.2%
HTML
9.2%
CSS
1.6%