- Python 99.2%
- HTML 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Tests / Ruff Linter (push) Successful in 6s
Tests / Ruff Formatter (push) Successful in 6s
PyPI Publish / Build (push) Successful in 17s
Tests / Pytest (Python 3.10, Django 5.2) (push) Successful in 13s
Tests / Pytest (Python 3.11, Django 5.2) (push) Successful in 12s
Tests / Pytest (Python 3.12, Django 5.2) (push) Successful in 12s
Tests / Pytest (Python 3.13, Django 5.2) (push) Successful in 13s
Tests / Pytest (Python 3.14, Django 5.2) (push) Successful in 16s
Tests / Pytest (Python 3.12, Django 6.0) (push) Successful in 13s
Tests / Pytest (Python 3.13, Django 6.0) (push) Successful in 13s
Tests / Pytest (Python 3.14, Django 6.0) (push) Successful in 14s
Tests / Pytest (Python 3.12, Django 6.1) (push) Successful in 13s
Tests / Pytest (Python 3.13, Django 6.1) (push) Successful in 14s
Tests / Pytest (Python 3.14, Django 6.1) (push) Successful in 14s
|
||
| .github/workflows | ||
| django_nitro_mailer | ||
| tests | ||
| .gitignore | ||
| dev_settings.py | ||
| django-nitro-mailer-logo.png | ||
| LICENSE | ||
| manage.py | ||
| MANIFEST.in | ||
| pyproject.toml | ||
| README.md | ||
| urls.py | ||
| uv.lock | ||
| zensical.toml | ||
📨 Django mails. Supercharged.
Overview
django-nitro-mailer is a pluggable Django app that provides extra email reliability and observability in form of email backends that can be used with Django's built-in functions and other email backend.
django-nitro-mailer by itself does not provide a way to send emails, but it puts an extra layer before the email backend to provide extra features like:
- priority queueing
- retrying failed emails
- logging and traces
- email throttling
- sending messages through the admin panel
Requirements
- Python >=3.10, <3.15
- Django >=5.2, <7.0
Installation
Install the package using pip:
$ pip install django-nitro-mailer
Usage
- Add
django_nitro_mailerto yourINSTALLED_APPSin yoursettings.py:
INSTALLED_APPS = [
...
"django_nitro_mailer",
...
]
-
Run
python manage.py migrateto create the necessary tables. -
Change the
EMAIL_BACKENDsetting in yoursettings.pyto use the desired backend:
- Database Backend: Store emails in the database and send them asynchronously. Requires sending a cron job or some other scheduled task to send the emails.
EMAIL_BACKEND = "django_nitro_mailer.backends.DatabaseBackend"
- Sync Backend: Send emails synchronously. Does not provide the reliability that the database backend provides, but still provides the logging and throttling features.
EMAIL_BACKEND = "django_nitro_mailer.backends.SyncBackend"
The emails are delivered using the backend from the NITRO_EMAIL_BACKEND setting (SMTP by default).
Django 6.1+ MAILERS
With Django 6.1 MAILERS, use a django-nitro-mailer backend as the default mailer and point NITRO_EMAIL_MAILER at a separate mailer alias that does the actual delivery:
import os
MAILERS = {
"default": {"BACKEND": "django_nitro_mailer.backends.DatabaseBackend"}, # or SyncBackend
"smtp": {
"BACKEND": "django.core.mail.backends.smtp.EmailBackend",
"OPTIONS": {
"host": "smtp.example.com",
"port": 587,
"username": os.environ["EMAIL_HOST_USER"],
"password": os.environ["EMAIL_HOST_PASSWORD"],
"use_tls": True,
},
},
}
NITRO_EMAIL_MAILER = "smtp"
NITRO_EMAIL_MAILER takes precedence over NITRO_EMAIL_BACKEND and must not point to a django-nitro-mailer backend. When MAILERS is configured, one of the two settings is required. The django-nitro-mailer backends themselves take no OPTIONS.
Documentation
Documentation is available here.
License
django-nitro-mailer is under the terms of the MIT License, following all clarifications stated in the license file.