De-celeried Django Yubin
Added in version 0.19.0: Added yubin celery cronjob bypass.
Re-writes parts of Django Yubin to bypass the need for celery tasks to queue and send emails.
Quickstart (tl;dr)
Install the extra dependencies:
uv pip install maykin-common[yubin]
Update your settings accordingly:
INSTALLED_APPS = [
...,
"django_yubin",
"maykin_common.yubin",
...
]
# use this instead of django-yubins backend
EMAIL_BACKEND = "maykin_common.yubin.backends.QueuedEmailBackend"
MAILER_USE_BACKEND = "django.core.mail.backends.smtp.EmailBackend" # the same setting from Django-yubin
Now using django’s send_mail will create and save a queued yubin Message without using the send_email task.
Then management commands and cronjobs can be used to send and retry emails without celery.
Warning
This does not monkeypatch the original yubin Message methods and Message.enqueue(...)
and Message.retry_messages(...) will still use the original celery tasks.
A proper monkeypatch might be added in the future.
Management Commands
Updates or deletes django-yubin Message emails bypassing the celery tasks.
delete_old_emails
./manage.py delete_old_emails --days 90
Delete Message instances that are older than a certain number of days.
By default this is 90 days but can be changed using --days argument.
retry_emails
./manage.py retry_emails --max-retries 0
Updates retryable Messages by changing their status back to queued. By default it will not allow retries
but this can be changed with the --max-retries or -m arguments
send_all_mail
./manage.py send_all_mail
Sends all queued Messages.