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.

Related tags

Email Djrill
Overview

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.

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 = "
         
          "
         
    EMAIL_BACKEND = "djrill.mail.backends.djrill.DjrillBackend"
    DEFAULT_FROM_EMAIL = "[email protected]"  # if you don't already have this in settings
  3. Now 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.

Comments
  • Support of an alternative transactional email services? (Post Mandrill)

    Support of an alternative transactional email services? (Post Mandrill)

    Hi,

    since Mandrill will close down soon, I wanted to ask if you consider supporting an alternative transactional email service?

    I love Djrill and it has done an awesome service for the last few years! Would love continue using it with an alternative service.

    opened by dh1tw 11
  • Wrong

    Wrong "To" in emails generated by django.utils.log.AdminEmailHandler

    After having my Django app running for a few months, I have generated a couple 404 reports. The issue is that they are not getting to me! I checked my MandrillApp logs, and it seems that this is what they are sending the emails to:

       "to": [
                {
                    "email": "y",
                    "name": ""
                },
                {
                    "email": "y",
                    "name": ""
                }
            ],
    

    Which doesnt make sense as it does have the ADMINS, MANAGERS, and SERVER_EMAIL defined correctly according to the Django documentation. Maybe I'm doing something wrong, but according to the config for my logging prefs:

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'filters': {
            'require_debug_false': {
                '()': 'django.utils.log.RequireDebugFalse'
            }
        },
        'handlers': {
            'mail_admins': {
                'level': 'ERROR',
                'filters': ['require_debug_false'],
                'class': 'django.utils.log.AdminEmailHandler'
            }
        },
        'loggers': {
            'django.request': {
                'handlers': ['mail_admins'],
                'level': 'ERROR',
                'propagate': True,
            },
        }
    }
    

    It seems like it should be sending it properly. Any suggestions?

    opened by wyattjoh 10
  • Send fails (old api?)

    Send fails (old api?)

    Attempts to send are failing, in DjrillBackend.open. It looks like Mandrill no longer requires (or offers) the verify-sender API.

    There appear to be fixes for this issue (and others) in the fork https://github.com/ripplemotion/Djrill

    opened by medmunds 10
  • Configure Djrill not to send error mails via Mandrill

    Configure Djrill not to send error mails via Mandrill

    Hi

    After reading the docs and googling a bit. It doesn't seem possible to get Djrill to not send error mails.

    I would like to send error mails via my normal SMTP server. I don't want error mails to count in my mandrill usage.

    opened by Hviid 9
  • Inbound webhook decorators not triggering

    Inbound webhook decorators not triggering

    We've been running inbound webhooks via djrill decorators for quite some time now. When suddenly they stopped working. Currently the signals are not triggering the decorated webhook functions, but the webhook does return a status 200. Because of this the problem took a while to get noticed.

    Unfortunately I can't retrace when this happened, so it could be a regression or just an incompatibility with the latest Django version.

    Currently broken for Django 1.9.2 and Djrill 2.0.

    opened by Koed00 8
  • SSL error

    SSL error

    Hi

    I get the below error while sending mail using djrill.

    app_1 | Traceback (most recent call last): app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response app_1 | response = wrapped_callback(request, _callback_args, *_callback_kwargs) app_1 | File "/code/invitations/views.py", line 102, in request_invite app_1 | msg.send() app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/mail/message.py", line 303, in send app_1 | return self.get_connection(fail_silently).send_messages([self]) app_1 | File "/usr/local/lib/python2.7/site-packages/djrill/mail/backends/djrill.py", line 81, in send_messages app_1 | sent = self._send(message) app_1 | File "/usr/local/lib/python2.7/site-packages/djrill/mail/backends/djrill.py", line 132, in _send app_1 | response = requests.post(api_url, data=api_data) app_1 | File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 109, in post app_1 | return request('post', url, data=data, json=json, *_kwargs) app_1 | File "/usr/local/lib/python2.7/site-packages/requests/api.py", line 50, in request app_1 | response = session.request(method=method, url=url, *_kwargs) app_1 | File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request app_1 | resp = self.send(prep, *_send_kwargs) app_1 | File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send app_1 | r = adapter.send(request, *_kwargs) app_1 | File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 431, in send app_1 | raise SSLError(e, request=request) app_1 | SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)

    Any ideas? I appreciate your help in this

    Cheers Roh

    opened by Roh-codeur 7
  • 2.x: drop support for DjrillAdminSite

    2.x: drop support for DjrillAdminSite

    Proposal for v2.x: remove the custom DjrillAdminSite.

    I'd be curious to hear how often people are actually using the Djrill admin views from within their Django projects' admin sites. (And which admin features you're using.) Please add comments to this issue if you have strong feelings one way or the other.

    Rationale for removing this functionality:

    • At this point, DjrillAdminSite mainly duplicates reporting functionality that's available (in more useful form) in Mandrill's own control panel.
    • The admin views add significantly to the Django version compatibility burden. (E.g., Djrill needs to register its own cycle templatetag for compatibility, purely because of the admin templates.)
    • I suspect most Djrill users never look at the Djrill admin views. (Thus the request for feedback above.)

    (Incidentally, the admin views originally helped site owners add and validate Mandrill senders -- a process that was relatively cumbersome at the time. But Mandrill dropped that requirement years ago, and we removed it from Djrill as well.)

    opened by medmunds 7
  • django 1.7b4

    django 1.7b4

    Exception Type: MandrillAPIError Exception Value:

    Mandrill API response 500 Failed to send a message to [{'name': '', 'type': 'to', 'email': '[email protected]'}], from [email protected]

    Exception Location: /home/evgen/git/clever3.3/lib/python3.3/site-packages/djrill/mail/backends/djrill.py in _send, line 119

    opened by axce1 7
  • ValueError: No JSON object could be decoded

    ValueError: No JSON object could be decoded

    Hello,

    I just installed Djrill and try to send test message:

    from django.core.mail import send_mail
    send_mail("It works!", 
              "This will get sent through Mandrill", 
              "[email protected]>", 
              ["[email protected]"], 
              html_message="<strong>This will</strong> get sent through Mandrill")
    

    The message is sent successfully to user but the code raise the next error:

    /home/user/venvpath/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
      InsecurePlatformWarning
    
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/home/user/venvpath/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
        return mail.send()
      File "/home/user/venvpath/local/lib/python2.7/site-packages/django/core/mail/message.py", line 303, in send
        return self.get_connection(fail_silently).send_messages([self])
      File "/home/user/venvpath/local/lib/python2.7/site-packages/djrill/mail/backends/djrill.py", line 81, in send_messages
        sent = self._send(message)
      File "/home/user/venvpath/local/lib/python2.7/site-packages/djrill/mail/backends/djrill.py", line 153, in _send
        message.mandrill_response = response.json()
      File "/home/user/venvpath/local/lib/python2.7/site-packages/requests/models.py", line 819, in json
        return json.loads(self.text, **kwargs)
      File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
        return _default_decoder.decode(s)
      File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
        raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded
    

    Python == 2.7.6 Django == 1.8.2 djrill == 1.4.0

    Many thanks for any help.

    opened by aisayko 6
  • `UnicodeEncodeError` with unicode attachments

    `UnicodeEncodeError` with unicode attachments

    If an attachment is added that contains unicode, sending the message fails with a UnicodeEncodeError. I have a branch with a failing test:

    ERROR: test_unicode_attachment_correctly_decoded (djrill.tests.test_mandrill_send.DjrillBackendTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/wes/policystat/workspace/Djrill/djrill/tests/test_mandrill_send.py", line 194, in test_unicode_attachment_correctly_decoded
        email.send()
      File "/home/wes/policystat/workspace/Djrill/Django-1.6.3-py2.7.egg/django/core/mail/message.py", line 274, in send
        return self.get_connection(fail_silently).send_messages([self])
      File "/home/wes/policystat/workspace/Djrill/djrill/mail/backends/djrill.py", line 68, in send_messages
        sent = self._send(message)
      File "/home/wes/policystat/workspace/Djrill/djrill/mail/backends/djrill.py", line 89, in _send
        self._add_attachments(message, msg_dict)
      File "/home/wes/policystat/workspace/Djrill/djrill/mail/backends/djrill.py", line 257, in _add_attachments
        att_dict, is_embedded = self._make_mandrill_attachment(attachment, str_encoding)
      File "/home/wes/policystat/workspace/Djrill/djrill/mail/backends/djrill.py", line 298, in _make_mandrill_attachment
        content_b64 = b64encode(content)
      File "/usr/lib/python2.7/base64.py", line 53, in b64encode
        encoded = binascii.b2a_base64(s)[:-1]
    UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 3: ordinal not in range(128)
    
    

    My plan is to treat python2.X like we're currently treating python3 by first converting to bytes.

    opened by winhamwr 6
  • New Djrill admin

    New Djrill admin

    A client asked me a feature: to see the message sent-status in the django admin. It was great to see this feature in Drill.

    Logging into Mandrill to look up a message status is not ideal. Definitely not for a client. Mandirll also keeps messages only for 30 or 90 days.

    I've found no existing django solution yet. Django mailer and django-mailer2 don't do it. Djrill showing me was great. Alas, the interface is not showing me message contents, and soon it will be removed in 2.0.

    There were good reasons for removing the Djrill admin site. But there's also good reason for adding a new lightweight one.

    How would it be possible to add a lightweight admin that shows a list of messages sent?

    Requirements:

    • Lightweight. No django admin changing and major dependency issues. Based on Mandrill api calls. Django mailer uses a cron job for regular interval tasks, that might be option.
    • Table with messages with mandrill sent-status, ordered by sent-date. Clickeable to show message content.
    • Try-catch statements in case Mandrill/connection is down.

    I'm willing to contribute

    opened by jdruiter 5
Owner
Brack3t
Brack3t
A Django email backend for Amazon's Simple Email Service

Django-SES Info: A Django email backend for Amazon's Simple Email Service Author: Harry Marr (http://github.com/hmarr, http://twitter.com/harrymarr) C

null 882 Dec 29, 2022
Email-bomber - Email bomber unlike other email bombers u don't need your gmail email id to use this

Email-bomber - Email bomber unlike other email bombers u don't need your gmail email id to use this

rfeferfefe 82 Dec 17, 2022
A Django email backend that uses a celery task for sending the email.

django-celery-email - A Celery-backed Django Email Backend A Django email backend that uses a Celery queue for out-of-band sending of the messages. Wa

Paul McLanahan 430 Dec 16, 2022
faceFarm is an active yahoo email detection script that functions to take over the facebook account using email.

faceFarm – The simple Email Detector. Email Valid Detector for Facebook (Yahoo) faceFarm is an active yahoo email detection script that functions to t

Fadjrir Herlambang 2 Jan 18, 2022
A Django app that allows you to send email asynchronously in Django. Supports HTML email, database backed templates and logging.

Django Post Office Django Post Office is a simple app to send and manage your emails in Django. Some awesome features are: Allows you to send email as

User Inspired 856 Dec 25, 2022
GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

GMailBomber is a form of Internet abuse which is perpetrated through the sending of massive volumes of email to a specific email address with the goal of overflowing the mailbox and overwhelming the mail server hosting the address, making it into some form of denial of service attack.

Muneeb 5 Nov 13, 2022
this is django project through this project you can easily sends message to any email

SEND-EMAIL this is django project through this project you can easily sends message to any email home when you run the server then you will see this t

Ankit jadhav 1 Oct 17, 2021
You take an email and password from the combo list file and check it on mail.com

Brute-Force-mail tool information: Combo Type: email:pass Domains: All domains of the site Url: https://www.mail.com Api: ☑️ Proxy: No ☑️ The correct

null 6 Jun 5, 2022
check disk storage's amount and if necessary, send alert message by email

DiskStorageAmountChecker What is this script? (このスクリプトは何ですか?) This script check disk storage's available amount of specified servers and send alerting

Hajime Kurita 1 Oct 22, 2021
Will iterate through a list of emails on an attached csv file and email all of them a message of your choice

Email_Bot Will iterate through a list of emails on an attached csv file and email all of them a message of your choice. Before using, make sure you al

J. Brandon Walker 1 Nov 30, 2021
Send email notification when receiving Facebook message.

Send email notification when receiving Facebook message.

Radon Rosborough 4 May 8, 2022
ParaskinioTouristOffices - This program sends a message to various email adresses

ParaskinioTouristOffices This program sends a message to various email adresses.

Odysseas Psomaderis 2 Feb 11, 2022
send email & telegram message whenever an analog in is recieved

send email & telegram message whenever an analog in is recieved (so when attached to an alarm siren out it will alert via mail)

Naor Livne 2 Feb 11, 2022
Secret Service Email Encryption/Steganography

SecretService Decoy Encrypted Emailer

Unit 221B 6 Aug 5, 2022
This Python program generates a random email address and password from a 2 big lists and checks the generated email.

This Python program generates a random email address and password from a 2 big lists and checks the generated email.

Killin 13 Dec 4, 2022
Esio_dev 3 Oct 15, 2021
Email-osint - Email OSINT tool written in python3

Email-osint - Email OSINT tool written in python3

Surtains 7 Nov 28, 2022
Django module to easily send emails/sms/tts/push using django templates stored on database and managed through the Django Admin

Django-Db-Mailer Documentation available at Read the Docs. What's that Django module to easily send emails/push/sms/tts using django templates stored

LPgenerator 250 Dec 21, 2022
Django email backends and webhooks for Amazon SES, Mailgun, Mailjet, Postmark, SendGrid, Sendinblue, SparkPost and more

Django email backends and webhooks for Amazon SES, Mailgun, Mailjet, Postmark, SendGrid, Sendinblue, SparkPost and more

null 1.4k Jan 1, 2023