django-ses is a Django email backend that integrates with Amazon's Simple Email Service (SES), offering a reliable and scalable way to send emails. It acts as a drop-in replacement for Django's default email backend, routing emails through AWS SES instead of traditional SMTP. The library, currently at version 4.7.2, is actively maintained with frequent releases to support new Django and Python versions, address bugs, and introduce new features like bounce/complaint handling and email receiving capabilities.
pip install django-sesVerified import paths — ran on the pinned version, not inferred.
Configure your Django `settings.py` to use `django_ses.SESBackend` and set your AWS credentials and region. It is highly recommended to manage `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SES_REGION_NAME` via environment variables or IAM roles for security. Ensure `DEFAULT_FROM_EMAIL` is set to an address or domain verified in AWS SES. Then, use Django's standard `send_mail` function to send emails.
Upgrade your Django project to a currently supported version (e.g., Django 4.2+ or 5.0+) to ensure ongoing compatibility and support for django-ses.
Apply for production access in the AWS SES console. Ensure all sender email addresses and domains are verified within AWS SES.
Store credentials in environment variables (e.g., via `os.environ`), use an IAM role if deployed on AWS EC2/Lambda, or leverage AWS CLI profiles. Remove hardcoded credentials from your source code.
Consult the official django-ses documentation for detailed setup instructions for bounce/complaint handling and email receiving if you intend to use these features. Ensure you run `python manage.py migrate` if using the blacklist models.
For API-based sending with additional features, use `django_ses.SESBackend`. For direct SMTP, configure `EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'` and provide the appropriate SES SMTP `EMAIL_HOST`, `EMAIL_HOST_USER`, and `EMAIL_HOST_PASSWORD` settings.