mitol-django-mail
This is the Open Learning Django Mail app. It provides a few key features around mail:
- Templated multipart html emails
- Automatic generation of plaintext portion of multipart email
- CSS inlining for email html
Getting started
pip install mitol-django-mail
Add the mail app:
INSTALLED_APPS = [
...
"mitol.mail.apps.MailApp",
]
Settings
Common Django settings
SITE_BASE_URL- the website's host url, including the protocol (e.g. "https://example.com/")SITE_NAME- the website's name
Mail app settings
All settings for the mitol-django-mail app are namespaced in django settings with MITOL_MAIL_ prefix.
MITOL_MAIL_FROM_EMAIL- the default from email for all messagesMITOL_MAIL_REPLY_TO_ADDRESS- the default reply-to email for all messagesMITOL_MAIL_MESSAGE_CLASSES- a list of fully qualified message class names that make the message classes available in the debuggerMITOL_MAIL_ENABLE_EMAIL_DEBUGGER-Trueif the email debugger should be enabled, you probably want to set this to the same value asDEBUGMITOL_MAIL_RECIPIENT_OVERRIDE- only used locally, this overrides the recipient of all outgoing email messagesMITOL_MAIL_FORMAT_RECIPIENT_FUNC- (optional) set to a custom function to format recipients. You'll typically use this if you're storing the name in a place other that Django's builtinUsermodel. Default:"mitol.mail.defaults.format_recipient".MITOL_MAIL_CAN_EMAIL_USER_FUNC- (optional) set to a custom function to determine whether a user can be sent an email. You'll typically use this if you have additional criteria beyond the user having an email. Default:"mitol.mail.defaults.can_email_user".MITOL_MAIL_CONNECTION_BACKEND- the connection backend to use for email sending. You'd use this only if you're doing something really custom thatanymaildoesn't give you. Default:"anymail.backends.mailgun.EmailBackend".
Usage
Create message classes
This involves subclassing mitol.mail.messages.TemplatedMessage. To subclass, do the following:
template_nameattribute -strthat denotes the directory withintemplates/mailthat this message's templates reside in (e.g."password_reset")nameattribute - a human-friendly name for your message (e.g."Password Reset")get_debug_template_context- static method that returns a context dict for rendering the email in the debugger
Define templates
In your apps's templates directory, create some templates:
templates/
mail/
{template_name}/
subject.txt
body.html
Configure settings.py
Add your custom message class to MITOL_MAIL_MESSAGE_CLASSES so it is available in the debugger.
Optional customizations
Optionally, you can also override:
get_base_template_context- extend the default base template context used with all emails of this type. Return type is adict. As a best practice you should be merging withsuper().get_base_template_context().get_default_headers- extend the default headers included with all emails of this type. Return type is adict. As a best practice you should be merging withsuper().get_default_headers().
Metadata
Release files for mitol-django-mail 2026.4.29
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 | |
|---|---|---|---|---|
| mitol_django_mail-2026.4.29.tar.gz | 13.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mitol_django_mail-2026.4.29-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.6 kB
Release files / mitol_django_mail-2026.4.29.tar.gz
| Download URL | mitol_django_mail-2026.4.29.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ba4f8dc32950c1796c5121d29346db3be8a205cf60e65af7203feec5e61994d
|
|
BLAKE2b-256 checksum How to use checksums |
9d93599cacd89feedbafb1996f61f762c26fc48a22107873ee24355d3af2dec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / mitol_django_mail-2026.4.29-py3-none-any.whl
| Download URL | mitol_django_mail-2026.4.29-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77e42ba048e59764cc2abd0b403515be8395a54afb5bf69a36c506bbee132406
|
|
BLAKE2b-256 checksum How to use checksums |
383b6bd15115bdf0197ba38f7d4f2f21556a9cc1abf61eeab1fcdd8d26892005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Security for mitol-django-mail 2026.4.29
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.