This release is a pre-release and may not be stable for production use.
lettermint-django
An unofficial Django email backend for Lettermint. Drop it in as your EMAIL_BACKEND and all Django mail (send_mail(), EmailMessage, EmailMultiAlternatives) routes through the Lettermint API. Supports per-message routing, HTML emails, attachments, and reply-to headers with no changes to your existing email code. An optional tracking application records sent messages and delivery events through Lettermint webhooks.
Built and maintained by zzinnovate. Not affiliated with Lettermint.
Documentation
- Getting Started: Installation • Configuration • Usage • Tracking • Bulk sending
- Reference: Settings • Backend
- Project: Contributing • Changelog • Security
Requirements
- Python 3.11+ (Django 6 requires Python 3.12+)
- Django 4.2, 5.x, or 6.x
- lettermint 2.0+
Install
pip install lettermint-django
# For development (includes testing tools)
pip install -e ".[dev]"
Quick start
import os
EMAIL_BACKEND = "lettermint_django.LettermintEmailBackend"
LETTERMINT_API_KEY = os.getenv("LETTERMINT_API_KEY")
That's it. All send_mail(), EmailMessage, and EmailMultiAlternatives calls in Django will now route through Lettermint.
Email tracking (optional)
Add the app, set the webhook secret and include the webhook URL to record every sent message and its delivery events (delivered, bounced, failed):
INSTALLED_APPS += ["lettermint_django"]
LETTERMINT_WEBHOOK_SECRET = os.getenv("LETTERMINT_WEBHOOK_SECRET")
# urls.py
path("", include("lettermint_django.urls")),
python manage.py migrate lettermint_django
Point a webhook in the Lettermint dashboard at /lettermint/message-events/ (change it with LETTERMINT_WEBHOOK_PATH). Query LmEmailMessage and LmEmailEvent, or connect to the lm_email_bounced signal. Settings control what is stored (subjects, event data, hashed addresses), X-Lettermint-Track: false skips a message, and manage.py lettermint_prune enforces a retention. See the tracking guide.
Bulk sending
Send the same mail to many people, or a personalised mail to each of them, in batches through Lettermint's batch endpoint:
from lettermint_django.bulk import send_bulk_mail
result = send_bulk_mail(
[{"email": g.email, "name": g.name, "link": g.invite_url} for g in guests],
subject="{{ name }}, you are invited",
text_template="emails/invite.txt",
html_template="emails/invite.html",
tag="invites",
)
result.sent_count, result.failed # per-message outcome, with message ids
See the bulk sending guide.
Roadmap
This project is actively developed with a clear path toward v1.0.0. Our roadmap includes email tracking, bounce monitoring, and engagement analytics.
- Current: v0.4.x (email backend, delivery tracking via webhooks, bulk sending, privacy controls)
- Next: v0.5.0 (opens, clicks, analytics)
- Planned: v1.0.0 (production-ready)
Settings Reference
| Setting | Required | Default | Description |
|---|---|---|---|
LETTERMINT_API_KEY |
Yes | - | Your project API token from the Lettermint dashboard |
LETTERMINT_BASE_URL |
No | SDK default | Override the Lettermint API base URL |
LETTERMINT_ROUTE |
No | - | Default route applied to all outgoing emails |
LETTERMINT_BULK_ROUTE |
No | - | Route applied to bulk sends, overriding LETTERMINT_ROUTE for those messages |
LETTERMINT_TIMEOUT |
No | SDK default | Request timeout in seconds |
LETTERMINT_WEBHOOK_SECRET |
With tracking | - | Signing secret of your Lettermint webhook |
LETTERMINT_WEBHOOK_PATH |
No | lettermint/message-events/ |
Path of the webhook endpoint |
LETTERMINT_BATCH_SIZE |
No | 500 | Messages per request for bulk sending |
LETTERMINT_TRACKING |
No | True |
False switches tracking off without removing the app |
LETTERMINT_TRACKING_RETENTION_DAYS |
No | - | Days lettermint_prune keeps tracking rows |
The other privacy settings are in the settings reference.
Per-message Route
Override the route for a specific message via extra_headers:
from django.core.mail import EmailMessage
msg = EmailMessage(
subject="Password reset",
body="Click the link...",
from_email="noreply@example.com",
to=["user@example.com"],
)
msg.extra_headers["X-Lettermint-Route"] = "app-priority"
msg.send()
HTML Emails
from django.core.mail import EmailMultiAlternatives
msg = EmailMultiAlternatives(
subject="Welcome",
body="Plain text fallback.",
from_email="noreply@example.com",
to=["user@example.com"],
)
msg.attach_alternative("<h1>Hello!</h1>", "text/html")
msg.send()
Contributing
Contributions are welcome. See CONTRIBUTING.md for development setup, testing, and workflow guidelines.
Security
See SECURITY.md for reporting vulnerabilities and best practices.
Credits
This package is built on top of the official lettermint Python SDK, which handles all API communication.
- Sjoerd Zaalberg van Zelst (zzinnovate)
- All contributors
License
MIT. See LICENSE.
Metadata
Release files for lettermint-django 0.4.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lettermint_django-0.4.0b2.tar.gz | 52.1 kB | With provenance | Details for lettermint_django-0.4.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lettermint_django-0.4.0b2-py3-none-any.whl | Python 3 | none | any | Details for lettermint_django-0.4.0b2-py3-none-any.whl |
Total release size: 101.3 kB
Release files / lettermint_django-0.4.0b2.tar.gz
| Download URL | lettermint_django-0.4.0b2.tar.gz |
|---|---|
| Size | 52.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c7aff93454e874bdf1d6c7bde9211daafa32930e75e2afabbecb3b83956d553
|
|
BLAKE2b-256 checksum How to use checksums |
74d8ced011ec07d637bbbc7414bd22938db756643f7f4da7d74dd0a7b99c42aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / lettermint_django-0.4.0b2-py3-none-any.whl
| Download URL | lettermint_django-0.4.0b2-py3-none-any.whl |
|---|---|
| Size | 49.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c28d14953b23197c2d81ac34f4f32ff8701ba2e575129fc09f6a077f956c4704
|
|
BLAKE2b-256 checksum How to use checksums |
3809032aed98bdfeef45afc4752c790e1ea522959e10c9b06a2a7f6ec60bd1d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for lettermint-django 0.4.0b2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lettermint_django-0.4.0b2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.