Skip to main content

An email manager for sending emails with templates, mail history and admin.

Project description

An email manager for sending emails with templates, mail history and admin.



The full documentation is at



Installation with pip:

pip install django-saas-email

Add it to your INSTALLED_APPS:


Add a template engine TEMPLATES:

        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "APP_DIRS": True,
        "DIRS": ["django_saas_email/templates/"],
        "NAME": "email",
        "OPTIONS": {"string_if_invalid": "{%s}"},


We are using the Postgres JSONField as default. If you installed psycopg2, everything should work fine.

If you are using a different database, you also need to install jsonfield:

pip install jsonfield

Adding the Sendgrid API Key to your settings



Other optional settings:
DJANGO_SAAS_FOOTER="""Follow <a href="#" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">@yourcompany</a> on Twitter"""

Sending emails

from django_saas_email.utils import create_and_send_mail

  'first_name': 'John',
  'last_name': 'Doe',


This will create an email and send it with Sengrid.

You should use or django-premailer to create Inline CSS in HTML

Background sending

This module sends emails asynchronously. To do that, it uses celery. You will need to run and configure celery to really send emails using the library.

The best source to do that is First Steps with Celery.

But you may use the following simple guide if you want to make it fast:

  1. Create a file aside your file with the following content:
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')

app = Celery(<YOUR_APP_NAME>)
app.config_from_object('django.conf:settings', namespace='CELERY')

Change <YOUR_APP_NAME> to the name of your app.

  1. Install RabbitMQ.
  2. Run celery:
celery -A <YOUR_APP_NAME> worker -B -l debug

Change <YOUR_APP_NAME> to the name of your app.

  1. Now you might just send the email with no problem using create_and_send_mail function.

Running Tests

Does the code actually work?:

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox


0.1.0 (2017-07-24)

  • First release on PyPI.

Project details

Download files

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

Source Distribution

django-saas-email-0.1.30.linux-x86_64.tar.gz (27.7 kB view hashes)

Uploaded source

Built Distribution

django_saas_email-0.1.30-py2.py3-none-any.whl (20.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page