skip to navigation
skip to content

Not Logged In

django-mail-utils 0.2.1

Django mail mixins and utilities

Latest Version: 0.3.1

=================
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
::  
File Type Py Version Uploaded on Size
django-mail-utils-0.2.1.tar.gz (md5) Source 2014-04-28 2KB
  • Downloads (All Versions):
  • 2 downloads in the last day
  • 67 downloads in the last week
  • 311 downloads in the last month