Djrill: Mandrill Transactional Email for Django
Djrill integrates the Mandrill transactional email service into Django.
PROJECT STATUS: INACTIVE
As of April, 2016, Djrill is no longer actively maintained (other than security updates). It is likely to keep working unless/until Mandrill changes their APIs, but Djrill will not be updated for newer Django versions or Mandrill changes. (more info)
You may be interested in django-anymail, a Djrill fork that supports Mailgun, Postmark, SendGrid, and other transactional ESPs (including limited support for Mandrill).
In general, Djrill "just works" with Django's built-in django.core.mail
package. It includes:
- Support for HTML, attachments, extra headers, and other features of Django's built-in email
- Mandrill-specific extensions like tags, metadata, tracking, and MailChimp templates
- Optional support for Mandrill inbound email and other webhook notifications, via Django signals
Djrill is released under the BSD license. It is tested against Django 1.4--1.9 (including Python 3 with Django 1.6+, and PyPy support with Django 1.5+). Djrill uses semantic versioning.
Resources
- Full documentation: https://djrill.readthedocs.io/en/latest/
- Package on PyPI: https://pypi.python.org/pypi/djrill
- Project on Github: https://github.com/brack3t/Djrill
Djrill 1-2-3
Install Djrill from PyPI:
$ pip install djrill
Edit your project's
settings.py
:INSTALLED_APPS = ( ... "djrill" ) MANDRILL_API_KEY = "
" EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend" DEFAULT_FROM_EMAIL = "[email protected]" # if you don't already have this in settingsNow the regular Django email functions will send through Mandrill:
", ["[email protected]"]) ">from django.core.mail import send_mail send_mail("It works!", "This will get sent through Mandrill", "Djrill Sender
" , ["[email protected]"])You could send an HTML message, complete with custom Mandrill tags and metadata:
", "[email protected]"], headers={'Reply-To': "Service"} # optional extra headers ) msg.attach_alternative(" This is the HTML email body
", "text/html") # Optional Mandrill-specific extensions: msg.tags = ["one tag", "two tag", "red tag", "blue tag"] msg.metadata = {'user_id': "8675309"} # Send it: msg.send() ">from django.core.mail import EmailMultiAlternatives msg = EmailMultiAlternatives( subject="Djrill Message", body="This is the text email body", from_email="Djrill Sender
" , to=["Recipient One" , "[email protected]"], headers={'Reply-To': "Service" } # optional extra headers ) msg.attach_alternative("This is the HTML email body
", "text/html") # Optional Mandrill-specific extensions: msg.tags = ["one tag", "two tag", "red tag", "blue tag"] msg.metadata = {'user_id': "8675309"} # Send it: msg.send()
See the full documentation for more features and options.