Django emails with html/txt templates

Django Templated Email is a tool which sends email in django with html/txt templates.


  • Html / Txt templates

  • Context variables

  • Current site (from sites framework) available in templates as {{ site }} variable

Installation and usage:

Run the following command inside your django's project directory
git submodule add templated_email


In file add "templated_email" to INSTALLED_APPS


Use the function. Example:

from templated_email import send_templated_email


"Example subject"
[''] #must be a list or tuple
context, # context variables to send in template
# cc = []
# bcc = []

Don't forget to create the template files.

In your templates folder, create a folder named 'email_templates'.

Place example-template.html or example-template.txt inside of it.





Popular posts from this blog

Compare integer variable in django templates

Top things to do after installing Manjaro KDE

PIP - upgrade all packages from requirements.txt (interactively)