This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Mailmate is a Django app comprised of tools to make dealing with emails easier. Its main feature is a simple, class-based way to define email messages using Django templates. Here’s a quick sales pitch:

from mailmate import TemplatedEmailMessage

class MyEmail(TemplatedEmailMessage):
    to = ['some-user@some-email.com']
    from_email = 'no-reply@some-email.com'
    subject = 'Hello, {{ name }}!'
    template = 'emails/template.txt'

MyEmail(extra_context={'name': 'Jerry'}).send()

Installation

pip install django-mailmate

TemplatedEmailMessage

Extend TemplatedEmailMessage, and set class attributes. You can override any of those attributes by passing keyword arguments to the constructor.

from mailmate import TemplatedEmailMessage

class MyEmail(TemplatedEmailMessage):
    to = ['some-user@some-email.com']
    from_email = 'no-reply@some-email.com'
    subject = 'Hello!'
    template = 'emails/template.txt'

MyEmail(to=['somebodyelse@somewhereelse.com']).send()

You can use a template to define your email body (like in the above example), or define it as a string:

from mailmate import TemplatedEmailMessage

class MyEmail(TemplatedEmailMessage):
    to = ['some-user@some-email.com']
    subject = "The subject is parsed as a {{ what }}"
    body = "The body's also parsed as a {{ what }}."

MyEmail(extra_context={'what': 'Django template!'}).send()

TemplatedEmailMessage also makes it simple to create HTML emails. Simply add an html_template_name attribute to your class (or pass it to the constructor):

from mailmate import TemplatedEmailMessage

class MyEmail(TemplatedEmailMessage):
    to = ['some-user@some-email.com']
    subject = "The subject is parsed as a {{ what }}"
    body = "The body's also parsed as a {{ what }}."
    html_template_name = 'emails/my_email.html'

The TemplatedEmailMessage class extends django.core.mail.EmailMultiAlternatives, so you don’t have to do anything special to use it with your favorite backend.

If you install markdownify, you can omit the plaintext version of your message; mailmate will generate one automatically from the HTML version. Otherwise, omitting both body and template_name will cause a MissingBody exception to be raised. If you want to send an email without a plaintext body, you must set body to an empty string explicitly.

CleanEmailBackend

Mailmate also includes a special backend to help you debug your emails. It’s like Django’s django.core.mail.backends.filebased.EmailBackend, but in addition to the *.log file, it will also save files containing the message body for each version of the message. For example, if you send an email that has both a plaintext and HTML version, it will save a *.log file (with the entire message), a *.txt file (with the plaintext body) and a *.html file (with the body of the HTML alternative).

To use it, set your EMAIL_BACKEND and EMAIL_FILE_PATH settings in settings.py:

EMAIL_BACKEND = 'mailmate.backends.CleanEmailBackend'
EMAIL_FILE_PATH = '/path/to/messages/'
Release History

Release History

1.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-mailmate-1.1.0.tar.gz (19.8 kB) Copy SHA256 Checksum SHA256 Source Aug 1, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting