Skip to content

Pythonic utility for sending template based emails with Django.

License

Notifications You must be signed in to change notification settings

incuna/incuna-mail

Repository files navigation

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='[email protected]',
    subject='Example email',
    template_name='plaintext_email.txt',
)

Supports cc and bcc...

... lists of recipients...

... 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=['[email protected]'],
)

... 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='[email protected]',
)

About

Pythonic utility for sending template based emails with Django.

Resources

License

Stars

Watchers

Forks

Packages

No packages published