3 Django apps for sending great e-mails

Flávio Juvenal
July 3, 2015
<p>Sending e-mails from a Django project? Those Django apps might help you:</p><h2 id="django-templated-email"><a href="https://github.com/BradWhittington/django-templated-email">django-templated-email</a></h2><p><a href="https://github.com/BradWhittington/django-templated-email">django-templated-email</a> allows you to send templated HTML or plaintext e-mails. Use Django template language with all templatetags and filters to easily build your e-mail templates.</p><h2 id="django-premailer"><a href="https://github.com/alexhayes/django-premailer">django-premailer</a></h2><p>Why using HTML e-mails if you can't style them with CSS? In fact, you can, but you should use <a href="https://css-tricks.com/using-css-in-html-emails-the-real-story/">inline styles</a>. Designing with <code>style="color: blue;"</code> can be a trouble for your frontend developers. <a href="https://github.com/alexhayes/django-premailer">django-premailer</a> solves that by inlining a CSS stylesheet in matching elements, making it a breeze to format e-mails.</p><p>Note for Mac users: django-premailer depends on lxml, which might be complicated to install on Mac OS. If you have trouble installing it, try <code>STATIC_DEPS=true pip install lxml</code> or one of other solutions <a href="http://stackoverflow.com/questions/19548011/cannot-install-lxml-on-mac-os-x-10-9">here</a></p><h2 id="django-naomi"><a href="https://github.com/edwinlunando/django-naomi">django-naomi</a></h2><p>Django e-mails are great with the two previous apps, but debugging emails in a development environment is still painful. It's cumbersome to check if e-mail was correctly sent with <a href="https://docs.djangoproject.com/en/dev/topics/email/#console-backend">console backend</a>, especially if some action sends multiple e-mails. Also, you don't know how HTML e-mail will be rendered by just looking at the console. <a href="https://docs.djangoproject.com/en/dev/topics/email/#file-backend">File backend</a> solves this problem just partially, since it doesn't shows the HTML immediately. But don't worry! <a href="https://github.com/edwinlunando/django-naomi">django-naomi</a> is here to help. Inspired by Ruby's Letter Opener, django-naomi is a custom Django <code>EMAIL_BACKEND</code> which simply opens a new tab in your browser with the e-mail info and content every time a e-mail is sent by your app. Couldn't be easier!</p><p>Do you know an alternative for one of these apps or think some other app should be mentioned? Let us know by commenting below. Thanks!</p>