Skip to content
This repository

Djrill is an email backend and new message class for Django users that want to take advantage of the Mandrill transactional email service from MailChimp.

branch: master

Use `override_settings` rather than mucking with settings in tests

Second attempt to address possible test sequencing issue around tests that alter settings. (Failures in Travis tests not reproducible locally.)

Back-ports override_settings from Django 1.4 for compatibility with Django 1.3.
latest commit 8815601b65
Mike Edmunds medmunds authored April 20, 2014
Octocat-spinner-32 djrill Use `override_settings` rather than mucking with settings in tests April 20, 2014
Octocat-spinner-32 docs Open 1.1 development April 20, 2014
Octocat-spinner-32 .gitignore Cleaned up .gitignor, PEP-8 issues and documentation June 02, 2013
Octocat-spinner-32 .travis.yml Oops: don't test Django 1.7b1 under Python 2.6 April 20, 2014
Octocat-spinner-32 AUTHORS.txt Subaccounts: Document setting; verify message option overrides global… April 20, 2014
Octocat-spinner-32 LICENSE added LICENSE file November 23, 2012
Octocat-spinner-32 MANIFEST.in added LICENSE file November 23, 2012
Octocat-spinner-32 README.rst Start testing Django 1.7b1 April 20, 2014
Octocat-spinner-32 runtests.py Start testing Django 1.7b1 April 20, 2014
Octocat-spinner-32 setup.py Fix links to outdated 'master' in RTD. January 25, 2014
README.rst

Djrill: Mandrill Transactional Email for Django

Djrill integrates the Mandrill transactional email service into Django.

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
  • An optional Django admin interface

Djrill is released under the BSD license. It is tested against Django 1.3---1.7b1 (including Python 3 support with Django 1.5+).

build status on Travis-CI

Resources

Djrill 1-2-3

  1. Install Djrill from PyPI:

    $ pip install djrill
    
  2. Edit your project's settings.py:

    INSTALLED_APPS = (
        ...
        "djrill"
    )
    
    MANDRILL_API_KEY = "<your Mandrill key>"
    EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend"
    
  3. Now the regular Django email functions will send through Mandrill:

    from django.core.mail import send_mail
    
    send_mail("It works!", "This will get sent through Mandrill",
        "Djrill Sender <djrill@example.com>", ["to@example.com"])
    

    You could send an HTML message, complete with custom Mandrill tags and metadata:

    from django.core.mail import EmailMultiAlternatives
    
    msg = EmailMultiAlternatives(
        subject="Djrill Message",
        body="This is the text email body",
        from_email="Djrill Sender <djrill@example.com>",
        to=["Recipient One <someone@example.com>", "another.person@example.com"],
        headers={'Reply-To': "Service <support@example.com>"} # optional extra headers
    )
    msg.attach_alternative("<p>This is the HTML email body</p>", "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.

Something went wrong with that request. Please try again.