Skip to main content

Django email backend using Huey

Project description

A simple Django email backend which uses Huey.

Usage

Add the app to your settings:

# settings.py

INSTALLED_APPS = [
    ...
    "huey.contrib.djhuey",
    "hueymail",
    ...
]

and use it as your email backend:

# settings.py

EMAIL_BACKEND = 'hueymail.backends.EmailBackend'

Last, choose which email backend Huey should dispatch to via the HUEY_EMAIL_BACKEND setting:

# settings.py

HUEY_EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

How it works

What happens when you send an email? Basically this:

  • Django creates a new instance of hueymail.backends.EmailBackend, and calls its send_messages() method with the email messages it wants to send.

  • The send_messages() method of the hueymail.backends.EmailBackend instance dispatches a Huey task called dispatch_messages(), which is responsible for sending those messages.

  • The dispatch_messages() task creates an instance of HUEY_EMAIL_BACKEND and calls its send_messages() method with the original email messages.

License

Copyright (c) 2022 Christopher McDonald

Distributed under the terms of the MIT license.

Project details


Download files

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

Source Distribution

django-huey-email-backend-0.1.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

django_huey_email_backend-0.1.1-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page