Skip to content
Send emails based on a Django template
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Send emails with Django templates


Create a template


{% block subject %}Subject{% endblock %}

{% block text %}Hello from {{ name }}{% endblock %}

{% block recipients %},{% endblock %}

Send the template:

from import send

send("myemail.html", dict(name=name))

This will send a text/plain email message using django.core.mail.EmailMessage to the specified recipients.

You can optionally add an html block to send a multipart email, or specify the html block only, which sends a text/html email.

Providing a request context

You can provide the request argument to have your email rendered using RequestContext instead.

def myview(request):
    send("myemail.html", dict(name=name), request=request)
    return HttpResponse("ok")


Install using pip:

pip install django-email-template

Install from github:

pip install -e git+git://

Running tests

Use the command in the tests directory.

You can’t perform that action at this time.