3 Django apps for sending great e-mails
Flávio Juvenal • 3 July 2015
Sending e-mails from a Django project? Those Django apps might help you:
django-templated-email 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.
Why using HTML e-mails if you can't style them with CSS? In fact, you can, but you should use inline styles. Designing with
style="color: blue;" can be a trouble for your frontend developers. django-premailer solves that by inlining a CSS stylesheet in matching elements, making it a breeze to format e-mails.
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
STATIC_DEPS=true pip install lxml or one of other solutions here
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 console backend, 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. File backend solves this problem just partially, since it doesn't shows the HTML immediately. But don't worry! django-naomi is here to help. Inspired by Ruby's Letter Opener, django-naomi is a custom Django
EMAIL_BACKEND 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!
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!