Skip to main content

Pythonic utility for sending template based emails with Django.

Project description

Incuna Mail Build Status Coverage Status Wheel Status Latest Version

Pythonic utility for sending template based emails with Django.

Installation

Install the package:

pip install incuna_mail

Usage

Import the send function and call it:

from incuna_mail import send

send(
    to='foo@example.com',
    subject='Example email',
    template_name='plaintext_email.txt',
)

Supports cc and bcc...

send(
    to='foo@example.com',
    cc='bar@example.com',
    bcc='baz@example.com',
    ...
)

... lists of recipients...

send(
    to=['foo@example.com', 'bar@example.com'],
    cc=['spam@example.com', 'eggs@example.com'],
    ...
)

... multi-part emails...

send(
    ...
    template_name='plaintext_email.txt',
    html_template_name='html_email.html',
)

... template context...

send(
    ...
    context={'user': user},
)

... template lists...

send(
    ...
    # Uses the first template found.
    template_name=['might-exist.html', 'will-exist.html'],
)

... reply-to addresses...

send(
    ...
    reply_to=['another@example.com'],
)

... and custom email headers:

send(
    ...
    headers={'Extra-Header': 'This will appear among the email headers'}
)

The email sender can be set globally with settings.DEFAULT_FROM_EMAIL, and will default to settings.SERVER_EMAIL. It can be explicitly set on each call, if required:

send(
    ...
    sender='eggy-mcspambot@example.com',
)

Download files

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

Files for incuna-mail, version 4.1.1
Filename, size File type Python version Upload date Hashes
Filename, size incuna_mail-4.1.1-py2.py3-none-any.whl (3.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size incuna-mail-4.1.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page