Skip to main content

django-postie

This project allows you to send emails and manage them in the admin panel. By default package uses celery to send emails.

Installation

Update INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'postie',
    'parler',
    'codemirror2',
    'ckeditor',
    'des',
    ...
]

Run migrations: `python manage.py migrate`

Available settings

POSTIE_TEMPLATE_CHOICES - Tuple of tuples. Where the first value is the value to use in code and second is verbose(translated).

POSTIE_TEMPLATE_CONTEXTS - dictionary with template choices as keys and dictionaries as values

For example:

POSTIE_TEMPLATE_CONTEXTS = {
    'mail_event': {
        'context_var1': _('Context variable 1 description'),
        'context_vae2': _('Context variable 2 user description'),
        ...
    },
    ...
}

POSTIE_INSTANT_SEND - whether to send letters instantly or to use celery task. If False celery is required.

POSTIE_HTML_ADMIN_WIDGET - dictionary with default widget for HTML field in Template model in django admin interface

For example:

POSTIE_HTML_ADMIN_WIDGET = {
    'widget': 'TinyMCE',
    'widget_module': 'tinymce',
    'attrs': {'attrs': {'cols': 80, 'rows': 10}}
}

POSTIE_DEBUG_MODE - controls whether to raise exceptions on send_mail. By default equals DEBUG

Basic example to use:

# your_module.py

from postie.shortcuts import send_mail

send_mail(
    event='MAIL_EVENT',
    recipients=['email@email.com', 'email1@email1.com'],
    context={
        'var1': 'variable context',
        'var2': 'another value'
    },
    from_email='noreply@email.com',
    attachments=[{
        'file_name': open('path-to-the-file')
    }]
)

Full documentation check here - https://cyberbudy.gitlab.io/django-postie/

Integrations

Tilda

To use https://tilda.cc/ add integration to settings

INSTALLED_APPS = [
    ...
    'postie.integrations.tilda',
    'solo',
    ...
]

Run migrations Now you can edit Tilda preferences and add corresponding tilda id to your mail templates in the admin.

Signals

There are two signals available:

tilda_webhook_received - This is send on webhook call.

Argumets:

request - request instance.

credentials - Credentials used to validate request

tilda_page_fetched - This is send when tilda_html is updated in the template.

Argumets:

project_id - Tilda project id.

page_id - Tilda page id.

template - MailTemplate was updated. If None - template with such page_id was not found.

Metadata

Release files for django-postie 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-postie 0.8.4
File Size Uploaded
django-postie-0.8.4.tar.gz 23.7 kB Details

Release files / django-postie-0.8.4.tar.gz

Download URL django-postie-0.8.4.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
396c932a7e6ca31629e742b3e5592f02009eb249ed77a2ba29aedc5da31f691d
BLAKE2b-256 checksum
How to use checksums
1a53fad8b85f66ace5e199d84e1d988c5391ca8bcf3660da5dc54ce09a4e156d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.8.4 This release

1 release file

0.8.3

1 release file

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

1 release file

0.7.1

2 release files

0.7.0

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page