Skip to main content
Help us improve Python packaging – donate today!

Django mail mixins and utilities

Project Description

=================
django-mail-utils
=================

Django mail mixins and utilities.

Contents
========
TemplateMessageMixin
--------------------
The mixin allows to create email body from a template (any text file).

| ``template_name`` - a path to a template in one of TEMPLATE_DIRs.
| ``template_context`` - a dictionary of variables passed to a template.

Both ``template_name`` and ``template_context`` can be set in inherited classes or
updated from constructor parameters.

Also you can pass the template string like the constructor's ``body`` parameter.
Then it will be used to render the real email's body.

EnvelopedMessageMixin
---------------------
The mixin allows to predefine email parameters ``subject``, ``from_email``, ``to``,
``cc`` and ``bcc``.

Parameters may be overridden via ``__init__``.


Installation
============
::

pip install django-mail-utils
::


Examples
========

TemplateMessageMixin
--------------------
::

from mail_utils.messages import TemplateMessageMixin

class RegistrationEmailMessage(TemplateMessageMixin, EmailMessage):
template_name = 'emails/registration.html'
template_context = {'from': 'Acme Corporation'}
::

EnvelopedMessageMixin
---------------------
::

from mail_utils.messages import EnvelopedMessageMixin

class NotificationEmailMessage(EnvelopedMessageMixin, EmailMessage):
subject = 'Admin News'
from_email = ADMIN_EMAIL
to = COLLEGUES_EMAILS
cc = CC_EMAILS
bcc = BCC_EMAILS
::

Release history Release notifications

History Node

0.3.1

History Node

0.3

This version
History Node

0.2.1

History Node

0.2

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
django-mail-utils-0.2.1.tar.gz (2.3 kB) Copy SHA256 hash SHA256 Source None Apr 28, 2014

Supported by

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