Skip to main content

An asynchronous Django email backend for Django Q2

Requirements

Installation

  • Install django-q2-email-backend:

pip install django-q2-email-backend
  • Add django_q2_email_backend to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    # other apps
    "django_q2_email_backend",
)

Configuration

Django 6.1 and later

Django 6.1 replaced the EMAIL_* settings with MAILERS. Add Q2EmailBackend as your default mailer, with a using option naming the mailer that will do the actual sending in the worker:

MAILERS = {
    "default": {
        "BACKEND": "django_q2_email_backend.backends.Q2EmailBackend",
        "OPTIONS": {"using": "smtp"},
    },
    "smtp": {
        "BACKEND": "django.core.mail.backends.smtp.EmailBackend",
        "OPTIONS": {"host": "smtp.example.com", "use_tls": True},
    },
}

using is required, as the worker would otherwise send through default and queue the message again.

fail_silently belongs on the mailer named by using, which is the one that sends. A silenced failure there leaves a successful task and no email.

Let the queue drain before adding MAILERS. Tasks queued beforehand name no mailer, and Django refuses to build a backend from the deprecated settings once MAILERS exists, so a worker that has it cannot send them.

Django 6.0 and earlier

Set django-q2-email-backend as your EMAIL_BACKEND:

EMAIL_BACKEND = "django_q2_email_backend.backends.Q2EmailBackend"

By default django-q2-email-backend will use Django’s builtin SMTP email backend for the actual sending of the mail. If you’d like to use another backend, you may set it in Q2_EMAIL_BACKEND just like you would normally have set EMAIL_BACKEND before you were using Q2. In fact, the normal installation procedure will most likely be to get your email working using only Django, then change EMAIL_BACKEND to Q2_EMAIL_BACKEND, and then add the new EMAIL_BACKEND setting from above.

EMAIL_BACKEND and Q2_EMAIL_BACKEND are ignored if MAILERS is defined, and stop working in Django 7.0.

Credits

Some code around serializing emails was taken from joeyespo/django-q-email

This package was created with Cookiecutter and the knyghty/cookiecutter-django-package project template.

Download files

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

Source Distribution

django_q2_email_backend-3.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_q2_email_backend-3.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file django_q2_email_backend-3.0.0.tar.gz.

File metadata

  • Download URL: django_q2_email_backend-3.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_q2_email_backend-3.0.0.tar.gz
Algorithm Hash digest
SHA256 99f23c88ca89fc6145d7bc909a86ec70ae9b1f89d3ac489df3946704f9d7f389
MD5 bc0ce5855b9086776fe562b6a5635434
BLAKE2b-256 29eaafb3580f4f895e619d0a0346495d76b6f063c9b8d92c0352a9a0133e6bbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_q2_email_backend-3.0.0.tar.gz:

Publisher: ci.yml on knyghty/django-q2-email-backend

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_q2_email_backend-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_q2_email_backend-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f41005d6839fd3efe8da59b6d91c80d2308bff230b4e1545c28a392d8cb181a
MD5 f41e991cbb81ee837c90ee189f2abda8
BLAKE2b-256 66b6be48d0cbfea7a9622aafd85ed71ac1d5211a93b4a7320723dcfe71e004e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_q2_email_backend-3.0.0-py3-none-any.whl:

Publisher: ci.yml on knyghty/django-q2-email-backend

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 files

2.1.0

2 files

2.0.0

2 files

1.0.0

2 files

0.2.0

2 files

0.1.0

2 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