Registry / aws / django-ses

django-ses

JSON →
library4.7.2pypypi✓ verified 27d ago

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-ses
INSTALL
IMPORT
SIG · DJANGO-SES
D
django-ses
awspythonv4.7.2
Install
5.9s avg
Import
—
Disk
100MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 100.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 5.9s · import 0.000s · 101MB
100MB installed
● package 100MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SESBackend
✓ EMAIL_BACKEND = 'django_ses.SESBackend'
Used in Django's settings.py to specify the email backend.

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.

import os from django.core.mail import send_mail # Ensure these are set in your Django settings.py # EMAIL_BACKEND = 'django_ses.SESBackend' # AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', '') # AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', '') # AWS_SES_REGION_NAME = os.environ.get('AWS_SES_REGION_NAME', 'us-east-1') # DEFAULT_FROM_EMAIL = 'verified-sender@example.com' # Example of sending a simple email if os.environ.get('AWS_ACCESS_KEY_ID') and os.environ.get('AWS_SECRET_ACCESS_KEY'): try: send_mail( 'Subject here', 'Here is the message body.', os.environ.get('DEFAULT_FROM_EMAIL', 'test@example.com'), ['recipient@example.com'], fail_silently=False, ) print("Email sent successfully!") except Exception as e: print(f"Failed to send email: {e}") else: print("AWS credentials not set in environment variables. Cannot send email.")
Debug
Known issues
deprecatedDjango 3.2 support was temporarily removed in v4.7.0 and re-added in v4.7.1, but the project maintainers plan to drop support for Django 3.2 as it is no longer officially supported by Django itself.
fix
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.
affects: >=4.7.0
gotchaAWS SES operates in a 'sandbox' mode by default for new accounts, restricting email sending to only verified email addresses or domains. To send emails to any recipient, you must request production access from AWS.
fix
Apply for production access in the AWS SES console. Ensure all sender email addresses and domains are verified within AWS SES.
affects: All versions
gotchaAWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) should never be hardcoded directly in your settings.py. This is a security risk.
fix
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.
affects: All versions
gotchaThe automatic bounce and complaint handling features (introduced in v4.2.0) and email receiving features (v4.3.0) require specific configuration (e.g., SNS topic, handler classes) and may involve database migrations. If not configured, these features will not work.
fix
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.
affects: >=4.2.0
gotchaWhen using `django_ses.SESBackend`, the library interacts with the SES API, not the SES SMTP endpoint. If you specifically require SMTP for AWS SES, you should use Django's built-in `django.core.mail.backends.smtp.EmailBackend` and configure it with SES SMTP credentials.
fix
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.
affects: All versions
Upgrade
Version history
4.7.2latest on PyPI · released Feb 20, 2026
Audit
Dependencies
DjangorequiredFramework dependency for the email backend.
boto3requiredAWS SDK for Python, used to interact with Amazon SES API.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
django-ses — pip install django-ses · libregistry