==========================================================
django-celery-email - A Celery-backed Django Email Backend
==========================================================
.. image:: https://img.shields.io/pypi/v/django-celery-email.svg
:target: https://pypi.python.org/pypi/django-celery-email
A `Django`_ email backend that uses a `Celery`_ queue for out-of-band sending
of the messages.
.. _`Celery`: http://celeryproject.org/
.. _`Django`: http://www.djangoproject.org/
.. warning::
This version requires the following versions:
* Python >= 3.8
* Django 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0
* Celery >= 5.0 (note that using Python >= 3.11 requires Celery >= 5.3)
Using django-celery-email
=========================
To enable ``django-celery-email`` for your project you need to add ``djcelery_email`` to
``INSTALLED_APPS``::
INSTALLED_APPS += ("djcelery_email",)
You must then set ``django-celery-email`` as your ``EMAIL_BACKEND``::
EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend'
By default ``django-celery-email`` 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 ``CELERY_EMAIL_BACKEND`` just like you would normally have set
``EMAIL_BACKEND`` before you were using Celery. In fact, the normal installation
procedure will most likely be to get your email working using only Django, then
change ``EMAIL_BACKEND`` to ``CELERY_EMAIL_BACKEND``, and then add the new
``EMAIL_BACKEND`` setting from above.
Mass email are sent in chunks of size ``CELERY_EMAIL_CHUNK_SIZE`` (defaults to 10).
If you need to set any of the settings (attributes) you'd normally be able to set on a
`Celery Task`_ class had you written it yourself, you may specify them in a ``dict``
in the ``CELERY_EMAIL_TASK_CONFIG`` setting::
CELERY_EMAIL_TASK_CONFIG = {
'queue' : 'email',
'rate_limit' : '50/m', # * CELERY_EMAIL_CHUNK_SIZE (default: 10)
...
}
There are some default settings. Unless you specify otherwise, the equivalent of the
following settings will apply::
CELERY_EMAIL_TASK_CONFIG = {
'name': 'djcelery_email_send',
'ignore_result': True,
}
After this setup is complete, and you have a working Celery install, sending
email will work exactly like it did before, except that the sending will be
handled by your Celery workers::
from django.core import mail
emails = (
('Hey Man', "I'm The Dude! So that's what you call me.", 'dude@aol.com', ['mr@lebowski.com']),
('Dammit Walter', "Let's go bowlin'.", 'dude@aol.com', ['wsobchak@vfw.org']),
)
results = mail.send_mass_mail(emails)
``results`` will be a list of celery `AsyncResult`_ objects that you may ignore, or use to check the
status of the email delivery task, or even wait for it to complete if want. You have to enable a result
backend and set ``ignore_result`` to ``False`` in ``CELERY_EMAIL_TASK_CONFIG`` if you want to use these.
You should also set ``CELERY_EMAIL_CHUNK_SIZE = 1`` in settings if you are concerned about task status
and results.
See the `Celery docs`_ for more info.
``len(results)`` will be the number of emails you attempted to send divided by CELERY_EMAIL_CHUNK_SIZE, and is in no way a reflection on the success or failure
of their delivery.
.. _`Celery Task`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#basics
.. _`Celery docs`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#task-states
.. _`AsyncResult`: http://celery.readthedocs.org/en/latest/reference/celery.result.html#celery.result.AsyncResult
Changelog
=========
4.0.0 - Unreleased
------------------
* Support for Django 4.0+
* Support for Python 3.10+
* Support for Celery 5.2+
* Drop support for Django 2.2
* Drop support for Celery 4
* Drop support for Python 3.7
3.1.0 - Unreleased
------------------
* Support for Django 3.1
* Support for Celery 5
3.0.0 - 2019.12.10
------------------
* Support for Django 3.0
* Support for Python 3.8
* Droppped support for Django 1.x, Django 2.0 and Django 2.1
* Droppped support for Python 2.7
2.0.2 - 2019.05.29
------------------
* Reduce memory usage by running email_to_dict on chunks. Thanks `Paul Brown`_.
* Simplify dict_to_email for readability and efficiency. Thanks `Paul Brown`_.
* Update test matrix for supported versions of Django, Celery and Python. Thanks `James`_.
.. _Paul Brown: https://github.com/pawl
.. _James: https://github.com/jmsmkn
2.0.1 - 2018.18.27
------------------
* Fix bug preventing sending text/* encoded mime attachments. Thanks `Cesar Canassa`_.
.. _Cesar Canassa: https://github.com/canassa
2.0 - 2017.07.10
----------------
* Support for Django 1.11 and Celery 4.0
* Dropped support for Celery 2.x and 3.x
* Dropped support for Python 3.3
1.1.5 - 2016.07.20
------------------
* Support extra email attributes via CELERY_EMAIL_MESSAGE_EXTRA_ATTRIBUTES setting
* Updated version requirements in README
1.1.4 - 2016.01.19
------------------
* Support sending email with embedded images. Thanks `Georg Zimmer`_.
* Document CELERY_EMAIL_CHUNK_SIZE. Thanks `Jonas Haag`_.
* Add exception handling to email backend connection. Thanks `Tom`_.
.. _Georg Zimmer: https://github.com/georgmzimmer
.. _Tom: https://github.com/tomleo
1.1.3 - 2015.11.06
------------------
* Support setting celery.base from string. Thanks `Matthew Jacobi`_.
* Use six for py2/3 string compatibility. Thanks `Matthew Jacobi`_.
* Pass content_subtype back in for retries. Thanks `Mark Joshua Tan`_.
* Rework how tests work, add tox, rework travis-ci matrix.
* Use six from django.utils.
* Release a universal wheel.
.. _Matthew Jacobi: https://github.com/oppianmatt
.. _Mark Joshua Tan: https://github.com/mark-tan
1.1.2 - 2015.07.06
------------------
* Fix for HTML-only emails. Thanks `gnarvaja`_.
.. _gnarvaja: https://github.com/gnarvaja
1.1.1 - 2015.03.20
------------------
* Fix for backward compatibility of task kwarg handling - Thanks `Jeremy Thurgood`_.
.. _Jeremy Thurgood: https://github.com/jerith
1.1.0 - 2015.03.06
------------------
* New PyPI release rolling up 1.0.5 changes and some cleanup.
* More backward compatability in task. Will still accept message objects and lists of message objects.
* Thanks again to everyone who contributed to 1.0.5.
1.0.5 - 2014.08.24
------------------
* Django 1.6 support, Travis CI testing, chunked sending & more - thanks `Jonas Haag`_.
* HTML email support - thanks `Andres Riancho`_.
* Support for JSON transit for Celery, sponsored by `DigiACTive`_.
* Drop support for Django 1.2.
.. _`Jonas Haag`: https://github.com/jonashaag
.. _`Andres Riancho`: https://github.com/andresriancho
.. _`DigiACTive`: https://github.com/digiactive
1.0.4 - 2013.10.12
------------------
* Add Django 1.5.2 and Python 3 support.
* Thanks to `Stefan Wehrmeyer`_ for the contribution.
.. _`Stefan Wehrmeyer`: https://github.com/stefanw
1.0.3 - 2012.03.06
------------------
* Backend will now pass any kwargs with which it is initialized to the
email sending backend.
* Thanks to `Fedor Tyurin`_ for the contribution.
.. _`Fedor Tyurin`: https://bitbucket.org/ftyurin
1.0.2 - 2012.02.21
------------------
* Task and backend now accept kwargs that can be used in signal handlers.
* Task now returns the result from the email sending backend.
* Thanks to `Yehonatan Daniv`_ for these changes.
.. _`Yehonatan Daniv`: https://bitbucket.org/ydaniv
1.0.1 - 2011.10.06
------------------
* Fixed a bug that resulted in tasks that were throwing errors reporting success.
* If there is an exception thrown by the sending email backend, the result of the task will
now be this exception.
Raw data
{
"_id": null,
"home_page": "https://github.com/panevo/django-celery-email",
"name": "panevo-django-celery-email",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Karlo Krakan",
"author_email": "karlo.krakan@panevo.com",
"download_url": "https://files.pythonhosted.org/packages/1b/35/d930d7abb022f17b35cc57fad83323c4a5de17cb19d9107a992d735b1288/panevo_django_celery_email-4.0.0.tar.gz",
"platform": "any",
"description": "==========================================================\ndjango-celery-email - A Celery-backed Django Email Backend\n==========================================================\n\n.. image:: https://img.shields.io/pypi/v/django-celery-email.svg\n :target: https://pypi.python.org/pypi/django-celery-email\n\nA `Django`_ email backend that uses a `Celery`_ queue for out-of-band sending\nof the messages.\n\n.. _`Celery`: http://celeryproject.org/\n.. _`Django`: http://www.djangoproject.org/\n\n.. warning::\n\n\tThis version requires the following versions:\n\n\t* Python >= 3.8\n\t* Django 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0\n\t* Celery >= 5.0 (note that using Python >= 3.11 requires Celery >= 5.3)\n\nUsing django-celery-email\n=========================\n\nTo enable ``django-celery-email`` for your project you need to add ``djcelery_email`` to\n``INSTALLED_APPS``::\n\n INSTALLED_APPS += (\"djcelery_email\",)\n\nYou must then set ``django-celery-email`` as your ``EMAIL_BACKEND``::\n\n EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend'\n\nBy default ``django-celery-email`` will use Django's builtin ``SMTP`` email backend\nfor the actual sending of the mail. If you'd like to use another backend, you\nmay set it in ``CELERY_EMAIL_BACKEND`` just like you would normally have set\n``EMAIL_BACKEND`` before you were using Celery. In fact, the normal installation\nprocedure will most likely be to get your email working using only Django, then\nchange ``EMAIL_BACKEND`` to ``CELERY_EMAIL_BACKEND``, and then add the new\n``EMAIL_BACKEND`` setting from above.\n\nMass email are sent in chunks of size ``CELERY_EMAIL_CHUNK_SIZE`` (defaults to 10).\n\nIf you need to set any of the settings (attributes) you'd normally be able to set on a\n`Celery Task`_ class had you written it yourself, you may specify them in a ``dict``\nin the ``CELERY_EMAIL_TASK_CONFIG`` setting::\n\n CELERY_EMAIL_TASK_CONFIG = {\n 'queue' : 'email',\n 'rate_limit' : '50/m', # * CELERY_EMAIL_CHUNK_SIZE (default: 10)\n ...\n }\n\nThere are some default settings. Unless you specify otherwise, the equivalent of the\nfollowing settings will apply::\n\n CELERY_EMAIL_TASK_CONFIG = {\n 'name': 'djcelery_email_send',\n 'ignore_result': True,\n }\n\nAfter this setup is complete, and you have a working Celery install, sending\nemail will work exactly like it did before, except that the sending will be\nhandled by your Celery workers::\n\n from django.core import mail\n\n emails = (\n ('Hey Man', \"I'm The Dude! So that's what you call me.\", 'dude@aol.com', ['mr@lebowski.com']),\n ('Dammit Walter', \"Let's go bowlin'.\", 'dude@aol.com', ['wsobchak@vfw.org']),\n )\n results = mail.send_mass_mail(emails)\n\n``results`` will be a list of celery `AsyncResult`_ objects that you may ignore, or use to check the\nstatus of the email delivery task, or even wait for it to complete if want. You have to enable a result\nbackend and set ``ignore_result`` to ``False`` in ``CELERY_EMAIL_TASK_CONFIG`` if you want to use these.\nYou should also set ``CELERY_EMAIL_CHUNK_SIZE = 1`` in settings if you are concerned about task status\nand results.\n\nSee the `Celery docs`_ for more info.\n\n\n``len(results)`` will be the number of emails you attempted to send divided by CELERY_EMAIL_CHUNK_SIZE, and is in no way a reflection on the success or failure\nof their delivery.\n\n.. _`Celery Task`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#basics\n.. _`Celery docs`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#task-states\n.. _`AsyncResult`: http://celery.readthedocs.org/en/latest/reference/celery.result.html#celery.result.AsyncResult\n\nChangelog\n=========\n\n4.0.0 - Unreleased\n------------------\n\n* Support for Django 4.0+\n* Support for Python 3.10+\n* Support for Celery 5.2+\n* Drop support for Django 2.2\n* Drop support for Celery 4\n* Drop support for Python 3.7\n\n3.1.0 - Unreleased\n------------------\n\n* Support for Django 3.1\n* Support for Celery 5\n\n3.0.0 - 2019.12.10\n------------------\n\n* Support for Django 3.0\n* Support for Python 3.8\n* Droppped support for Django 1.x, Django 2.0 and Django 2.1\n* Droppped support for Python 2.7\n\n2.0.2 - 2019.05.29\n------------------\n\n* Reduce memory usage by running email_to_dict on chunks. Thanks `Paul Brown`_.\n* Simplify dict_to_email for readability and efficiency. Thanks `Paul Brown`_.\n* Update test matrix for supported versions of Django, Celery and Python. Thanks `James`_.\n\n.. _Paul Brown: https://github.com/pawl\n.. _James: https://github.com/jmsmkn\n\n2.0.1 - 2018.18.27\n------------------\n* Fix bug preventing sending text/* encoded mime attachments. Thanks `Cesar Canassa`_.\n\n.. _Cesar Canassa: https://github.com/canassa\n\n2.0 - 2017.07.10\n----------------\n* Support for Django 1.11 and Celery 4.0\n* Dropped support for Celery 2.x and 3.x\n* Dropped support for Python 3.3\n\n1.1.5 - 2016.07.20\n------------------\n* Support extra email attributes via CELERY_EMAIL_MESSAGE_EXTRA_ATTRIBUTES setting\n* Updated version requirements in README\n\n\n1.1.4 - 2016.01.19\n------------------\n\n* Support sending email with embedded images. Thanks `Georg Zimmer`_.\n* Document CELERY_EMAIL_CHUNK_SIZE. Thanks `Jonas Haag`_.\n* Add exception handling to email backend connection. Thanks `Tom`_.\n\n.. _Georg Zimmer: https://github.com/georgmzimmer\n.. _Tom: https://github.com/tomleo\n\n1.1.3 - 2015.11.06\n------------------\n\n* Support setting celery.base from string. Thanks `Matthew Jacobi`_.\n* Use six for py2/3 string compatibility. Thanks `Matthew Jacobi`_.\n* Pass content_subtype back in for retries. Thanks `Mark Joshua Tan`_.\n* Rework how tests work, add tox, rework travis-ci matrix.\n* Use six from django.utils.\n* Release a universal wheel.\n\n.. _Matthew Jacobi: https://github.com/oppianmatt\n.. _Mark Joshua Tan: https://github.com/mark-tan\n\n1.1.2 - 2015.07.06\n------------------\n\n* Fix for HTML-only emails. Thanks `gnarvaja`_.\n\n.. _gnarvaja: https://github.com/gnarvaja\n\n1.1.1 - 2015.03.20\n------------------\n\n* Fix for backward compatibility of task kwarg handling - Thanks `Jeremy Thurgood`_.\n\n.. _Jeremy Thurgood: https://github.com/jerith\n\n1.1.0 - 2015.03.06\n------------------\n\n* New PyPI release rolling up 1.0.5 changes and some cleanup.\n* More backward compatability in task. Will still accept message objects and lists of message objects.\n* Thanks again to everyone who contributed to 1.0.5.\n\n1.0.5 - 2014.08.24\n------------------\n\n* Django 1.6 support, Travis CI testing, chunked sending & more - thanks `Jonas Haag`_.\n* HTML email support - thanks `Andres Riancho`_.\n* Support for JSON transit for Celery, sponsored by `DigiACTive`_.\n* Drop support for Django 1.2.\n\n.. _`Jonas Haag`: https://github.com/jonashaag\n.. _`Andres Riancho`: https://github.com/andresriancho\n.. _`DigiACTive`: https://github.com/digiactive\n\n1.0.4 - 2013.10.12\n------------------\n\n* Add Django 1.5.2 and Python 3 support.\n* Thanks to `Stefan Wehrmeyer`_ for the contribution.\n\n.. _`Stefan Wehrmeyer`: https://github.com/stefanw\n\n1.0.3 - 2012.03.06\n------------------\n\n* Backend will now pass any kwargs with which it is initialized to the\n email sending backend.\n* Thanks to `Fedor Tyurin`_ for the contribution.\n\n.. _`Fedor Tyurin`: https://bitbucket.org/ftyurin\n\n\n1.0.2 - 2012.02.21\n------------------\n\n* Task and backend now accept kwargs that can be used in signal handlers.\n* Task now returns the result from the email sending backend.\n* Thanks to `Yehonatan Daniv`_ for these changes.\n\n.. _`Yehonatan Daniv`: https://bitbucket.org/ydaniv\n\n1.0.1 - 2011.10.06\n------------------\n\n* Fixed a bug that resulted in tasks that were throwing errors reporting success.\n* If there is an exception thrown by the sending email backend, the result of the task will\n now be this exception.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "An async Django email backend using celery (fork)",
"version": "4.0.0",
"project_urls": {
"Homepage": "https://github.com/panevo/django-celery-email"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6d4582d84c3b936000798cfc42da01a8361bee939362e5deb2a7f0e18e4ce6d2",
"md5": "63b47385caab848d55e2421ffbbaf6c6",
"sha256": "b22f5dfb0685e29e1ec23dda4fc0da7e76e603948c51676f3f8da25b3c81d42a"
},
"downloads": -1,
"filename": "panevo_django_celery_email-4.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "63b47385caab848d55e2421ffbbaf6c6",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 9657,
"upload_time": "2024-05-23T16:40:03",
"upload_time_iso_8601": "2024-05-23T16:40:03.208328Z",
"url": "https://files.pythonhosted.org/packages/6d/45/82d84c3b936000798cfc42da01a8361bee939362e5deb2a7f0e18e4ce6d2/panevo_django_celery_email-4.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1b35d930d7abb022f17b35cc57fad83323c4a5de17cb19d9107a992d735b1288",
"md5": "b7a62e432b5bc50337455ab44551bbd9",
"sha256": "b12cc7c35a7b1115b2fb78903d91d031b6b631231fa3fcd7c72628a96d633cae"
},
"downloads": -1,
"filename": "panevo_django_celery_email-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "b7a62e432b5bc50337455ab44551bbd9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15171,
"upload_time": "2024-05-23T16:40:14",
"upload_time_iso_8601": "2024-05-23T16:40:14.246618Z",
"url": "https://files.pythonhosted.org/packages/1b/35/d930d7abb022f17b35cc57fad83323c4a5de17cb19d9107a992d735b1288/panevo_django_celery_email-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-23 16:40:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "panevo",
"github_project": "django-celery-email",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"3.0"
]
]
},
{
"name": "celery",
"specs": [
[
">=",
"5.0"
]
]
},
{
"name": "django-appconf",
"specs": []
},
{
"name": "flake8",
"specs": []
},
{
"name": "twine",
"specs": []
},
{
"name": "wheel",
"specs": []
}
],
"tox": true,
"lcname": "panevo-django-celery-email"
}