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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99f23c88ca89fc6145d7bc909a86ec70ae9b1f89d3ac489df3946704f9d7f389
|
|
| MD5 |
bc0ce5855b9086776fe562b6a5635434
|
|
| BLAKE2b-256 |
29eaafb3580f4f895e619d0a0346495d76b6f063c9b8d92c0352a9a0133e6bbf
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_q2_email_backend-3.0.0.tar.gz -
Subject digest:
99f23c88ca89fc6145d7bc909a86ec70ae9b1f89d3ac489df3946704f9d7f389 - Sigstore transparency entry: 2360795231
- Sigstore integration time:
-
Permalink:
knyghty/django-q2-email-backend@0f368839585b1fb07cfc7c18525d86305558d847 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/knyghty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0f368839585b1fb07cfc7c18525d86305558d847 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_q2_email_backend-3.0.0-py3-none-any.whl.
File metadata
- Download URL: django_q2_email_backend-3.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f41005d6839fd3efe8da59b6d91c80d2308bff230b4e1545c28a392d8cb181a
|
|
| MD5 |
f41e991cbb81ee837c90ee189f2abda8
|
|
| BLAKE2b-256 |
66b6be48d0cbfea7a9622aafd85ed71ac1d5211a93b4a7320723dcfe71e004e9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_q2_email_backend-3.0.0-py3-none-any.whl -
Subject digest:
9f41005d6839fd3efe8da59b6d91c80d2308bff230b4e1545c28a392d8cb181a - Sigstore transparency entry: 2360795266
- Sigstore integration time:
-
Permalink:
knyghty/django-q2-email-backend@0f368839585b1fb07cfc7c18525d86305558d847 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/knyghty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0f368839585b1fb07cfc7c18525d86305558d847 -
Trigger Event:
release
-
Statement type: