Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Mixed content e-mails for Django made simple.

Project Description


Easy sending of mixed content (html + plain) emails for Django.


  • Django 1.5.+
  • Python 2.7.+, 3.3.+


  1. Install in your virtual environment:

    $ pip install django-lime

  2. Add lime to your INSTALLED_APPS of your Django settings module:

>>>     # ...
>>>     'lime',
>>>     # ...
>>> )
>>> LIME_SITE_LOGO = 'img/logo.png' # Relative path to logo
>>> LIME_SITE_TEAM = ugettext("Example site team") # Team name (see the base email template)
  1. Copy the templates from lime to your main templates directory.
  2. Define LIME_SITE_LOGO and LIME_SITE_TEAM variables in your settings module.
  3. Make sure your django.contrib.sites.models.Site has data that makes sense, as site_name and domain values will be taken from there. Alternatively, you can define (override) those by defining the following variables in your settings module.

Usage examples

Inherit your app templates from lime base templates or your own copy of the lime templates (copied to templates directory). By default the following parameters are passed to your template:

  • site_name: Taken from your django.contrib.sites.models.Site.
  • domain: Taken from your django.contrib.sites.models.Site
  • site_team: Site team name.
  • site_logo: Relative URL to site logo.

Sending of a mixed content e-mail is as simple as follows.

  • subject (str): E-mail subject.
  • from_email (str): From e-mail.
  • to (str or list): E-mail or a list of e-mails to send the e-mail to.
  • context (dict): Variables you want to have accessible in your e-mail templates.
  • plain_template (str): Plain template name.
  • html_template (str): HTML template name.
  • bcc (str or list): E-mail or a list of e-mails to send the e-mail to (as BCC).
>>> from lime import send_email
>>> send_email(
>>>     subject = _("You've got mail"),
>>>     from_email = 'ramzes.4@example.come', # From
>>>     to = '', # To
>>>     context = {
>>>         'date_submitted':"%Y-%m-%dT%H:%M:%S"),
>>>         'url': '',
>>>         'full_name': 'John Doe',
>>>         'from_name': 'Ramzes the 4th',
>>>     },
>>>     plain_template = 'foo/emails/foo_test.txt', # Text template
>>>     html_template = 'foo/emails/foo_test.html' # HTML tempalte
>>> )

Running example project

For a working example (including set-up Django environment) check the (example directory).

  1. Go to example/example directory

    $ cd example/example

  2. Install requirements (in your virtual environment)

    $ pip install -r requirements.txt

  3. Copy local_settings.example to

    $ cp local_settings.example

  4. Create the database

    $ ./ syncdb

  5. Run the project

    $ ./ runserver


GPL 2.0/LGPL 2.1


For any issues contact me at the e-mail given in the Author section.


Artur Barseghyan <>

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.2 kB) Copy SHA256 Hash SHA256
Source None Sep 10, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate