Skip to main content

Mandrill transactional email for Django

Project description

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.

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"
    DEFAULT_FROM_EMAIL = "you@example.com"  # if you don't already have this in settings
  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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djrill-2.1.0.tar.gz (13.1 kB view details)

Uploaded Source

File details

Details for the file djrill-2.1.0.tar.gz.

File metadata

  • Download URL: djrill-2.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djrill-2.1.0.tar.gz
Algorithm Hash digest
SHA256 1047a11f3982816aa3aa02eab778e199d5d9561815fe01460f45f70a503c65f4
MD5 3b5c0bbdc8b70c83935ed02943c11011
BLAKE2b-256 9f33b385e7823be0dfa375444cae71be9dd1450fea31f7dbf19f734e572ff849

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page