Skip to main content

Django module to easily send templated emails in a DRY way

Project description

Build Status Codacy Badge Coverage Status BCH compliance Pypi

Django module to easily send templated emails in a DRY way using classes, just like Class Based Views.

Table of contents:

How to install

To install the app run :

pip install django-cbmail

or add it to the list of requirements of your project.

Example usage

Create a and use the BaseMail class to define your email like:

from cbmail.base import BaseMail

class ExampleEmail(BaseMail):
    """ """
    template_name = "myapp/mails/myemail.html"
    subject = "Example subject of email"

And send it using:


Where [''] is a list of emails of destination or a object with get_mailing_list method defined

Settings reference

To give support to this app we need to declare de following django settings:


    'DEFAULT_SUJECT': "Example subject",
    'BASE_URL': "",
    'EXTRA_DATA': {},
    'WHITELIST': []
  • DEFAULT_FROM_EMAIL: Default setting of Django that defines the from email
  • DEFAULT_REPLY_TO: Default reply to be used on emails
  • DEFAULT_SUJECT: Default subject to be used on emails
  • WHITELIST: List of valid emails to send to
  • BASE_URL: The base url of your website
  • EXTRA_DATA: Any extra data intended to be used on all emails (This is injected on context of template)


MIT license, see the LICENSE file. You can use obfuscator in open source projects and commercial products.

Project details

Download files

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

Files for django-cbmail, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django_cbmail-0.1.1-py2-none-any.whl (10.4 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size django-cbmail-0.1.1.tar.gz (10.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page