| 1 |
Metadata-Version: 1.1 |
| 2 |
Name: django-celery-email |
| 3 |
Version: 3.0.0 |
| 4 |
Summary: An async Django email backend using celery |
| 5 |
Home-page: https://github.com/pmclanahan/django-celery-email |
| 6 |
Author: Paul McLanahan |
| 7 |
Author-email: [email protected] |
| 8 |
License: BSD |
| 9 |
Description: ========================================================== |
| 10 |
django-celery-email - A Celery-backed Django Email Backend |
| 11 |
========================================================== |
| 12 |
|
| 13 |
.. image:: https://img.shields.io/travis/pmclanahan/django-celery-email/master.svg |
| 14 |
:target: https://travis-ci.org/pmclanahan/django-celery-email |
| 15 |
.. image:: https://img.shields.io/pypi/v/django-celery-email.svg |
| 16 |
:target: https://pypi.python.org/pypi/django-celery-email |
| 17 |
|
| 18 |
A `Django`_ email backend that uses a `Celery`_ queue for out-of-band sending |
| 19 |
of the messages. |
| 20 |
|
| 21 |
.. _`Celery`: http://celeryproject.org/ |
| 22 |
.. _`Django`: http://www.djangoproject.org/ |
| 23 |
|
| 24 |
.. warning:: |
| 25 |
|
| 26 |
This version requires the following versions: |
| 27 |
|
| 28 |
* Python >= 3.5 |
| 29 |
* Django 2.2, and 3.0 |
| 30 |
* Celery 4.0 |
| 31 |
|
| 32 |
Using django-celery-email |
| 33 |
========================= |
| 34 |
|
| 35 |
To enable ``django-celery-email`` for your project you need to add ``djcelery_email`` to |
| 36 |
``INSTALLED_APPS``:: |
| 37 |
|
| 38 |
INSTALLED_APPS += ("djcelery_email",) |
| 39 |
|
| 40 |
You must then set ``django-celery-email`` as your ``EMAIL_BACKEND``:: |
| 41 |
|
| 42 |
EMAIL_BACKEND = 'djcelery_email.backends.CeleryEmailBackend' |
| 43 |
|
| 44 |
By default ``django-celery-email`` will use Django's builtin ``SMTP`` email backend |
| 45 |
for the actual sending of the mail. If you'd like to use another backend, you |
| 46 |
may set it in ``CELERY_EMAIL_BACKEND`` just like you would normally have set |
| 47 |
``EMAIL_BACKEND`` before you were using Celery. In fact, the normal installation |
| 48 |
procedure will most likely be to get your email working using only Django, then |
| 49 |
change ``EMAIL_BACKEND`` to ``CELERY_EMAIL_BACKEND``, and then add the new |
| 50 |
``EMAIL_BACKEND`` setting from above. |
| 51 |
|
| 52 |
Mass email are sent in chunks of size ``CELERY_EMAIL_CHUNK_SIZE`` (defaults to 10). |
| 53 |
|
| 54 |
If you need to set any of the settings (attributes) you'd normally be able to set on a |
| 55 |
`Celery Task`_ class had you written it yourself, you may specify them in a ``dict`` |
| 56 |
in the ``CELERY_EMAIL_TASK_CONFIG`` setting:: |
| 57 |
|
| 58 |
CELERY_EMAIL_TASK_CONFIG = { |
| 59 |
'queue' : 'email', |
| 60 |
'rate_limit' : '50/m', # * CELERY_EMAIL_CHUNK_SIZE (default: 10) |
| 61 |
... |
| 62 |
} |
| 63 |
|
| 64 |
There are some default settings. Unless you specify otherwise, the equivalent of the |
| 65 |
following settings will apply:: |
| 66 |
|
| 67 |
CELERY_EMAIL_TASK_CONFIG = { |
| 68 |
'name': 'djcelery_email_send', |
| 69 |
'ignore_result': True, |
| 70 |
} |
| 71 |
|
| 72 |
After this setup is complete, and you have a working Celery install, sending |
| 73 |
email will work exactly like it did before, except that the sending will be |
| 74 |
handled by your Celery workers:: |
| 75 |
|
| 76 |
from django.core import mail |
| 77 |
|
| 78 |
emails = ( |
| 79 |
('Hey Man', "I'm The Dude! So that's what you call me.", '[email protected]', ['[email protected]']), |
| 80 |
('Dammit Walter', "Let's go bowlin'.", '[email protected]', ['[email protected]']), |
| 81 |
) |
| 82 |
results = mail.send_mass_mail(emails) |
| 83 |
|
| 84 |
``results`` will be a list of celery `AsyncResult`_ objects that you may ignore, or use to check the |
| 85 |
status of the email delivery task, or even wait for it to complete if want. You have to enable a result |
| 86 |
backend and set ``ignore_result`` to ``False`` in ``CELERY_EMAIL_TASK_CONFIG`` if you want to use these. |
| 87 |
You should also set ``CELERY_EMAIL_CHUNK_SIZE = 1`` in settings if you are concerned about task status |
| 88 |
and results. |
| 89 |
|
| 90 |
See the `Celery docs`_ for more info. |
| 91 |
|
| 92 |
|
| 93 |
``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 |
| 94 |
of their delivery. |
| 95 |
|
| 96 |
.. _`Celery Task`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#basics |
| 97 |
.. _`Celery docs`: http://celery.readthedocs.org/en/latest/userguide/tasks.html#task-states |
| 98 |
.. _`AsyncResult`: http://celery.readthedocs.org/en/latest/reference/celery.result.html#celery.result.AsyncResult |
| 99 |
|
| 100 |
Changelog |
| 101 |
========= |
| 102 |
|
| 103 |
3.0.0 - 2019.12.10 |
| 104 |
------------------ |
| 105 |
|
| 106 |
* Support for Django 3.0 |
| 107 |
* Support for Python 3.8 |
| 108 |
* Droppped support for Django 1.x, Django 2.0 and Django 2.1 |
| 109 |
* Droppped support for Python 2.7 |
| 110 |
|
| 111 |
2.0.2 - 2019.05.29 |
| 112 |
------------------ |
| 113 |
|
| 114 |
* Reduce memory usage by running email_to_dict on chunks. Thanks `Paul Brown`_. |
| 115 |
* Simplify dict_to_email for readability and efficiency. Thanks `Paul Brown`_. |
| 116 |
* Update test matrix for supported versions of Django, Celery and Python. Thanks `James`_. |
| 117 |
|
| 118 |
.. _Paul Brown: https://github.com/pawl |
| 119 |
.. _James: https://github.com/jmsmkn |
| 120 |
|
| 121 |
2.0.1 - 2018.18.27 |
| 122 |
------------------ |
| 123 |
* Fix bug preventing sending text/* encoded mime attachments. Thanks `Cesar Canassa`_. |
| 124 |
|
| 125 |
.. _Cesar Canassa: https://github.com/canassa |
| 126 |
|
| 127 |
2.0 - 2017.07.10 |
| 128 |
---------------- |
| 129 |
* Support for Django 1.11 and Celery 4.0 |
| 130 |
* Dropped support for Celery 2.x and 3.x |
| 131 |
* Dropped support for Python 3.3 |
| 132 |
|
| 133 |
1.1.5 - 2016.07.20 |
| 134 |
------------------ |
| 135 |
* Support extra email attributes via CELERY_EMAIL_MESSAGE_EXTRA_ATTRIBUTES setting |
| 136 |
* Updated version requirements in README |
| 137 |
|
| 138 |
|
| 139 |
1.1.4 - 2016.01.19 |
| 140 |
------------------ |
| 141 |
|
| 142 |
* Support sending email with embedded images. Thanks `Georg Zimmer`_. |
| 143 |
* Document CELERY_EMAIL_CHUNK_SIZE. Thanks `Jonas Haag`_. |
| 144 |
* Add exception handling to email backend connection. Thanks `Tom`_. |
| 145 |
|
| 146 |
.. _Georg Zimmer: https://github.com/georgmzimmer |
| 147 |
.. _Tom: https://github.com/tomleo |
| 148 |
|
| 149 |
1.1.3 - 2015.11.06 |
| 150 |
------------------ |
| 151 |
|
| 152 |
* Support setting celery.base from string. Thanks `Matthew Jacobi`_. |
| 153 |
* Use six for py2/3 string compatibility. Thanks `Matthew Jacobi`_. |
| 154 |
* Pass content_subtype back in for retries. Thanks `Mark Joshua Tan`_. |
| 155 |
* Rework how tests work, add tox, rework travis-ci matrix. |
| 156 |
* Use six from django.utils. |
| 157 |
* Release a universal wheel. |
| 158 |
|
| 159 |
.. _Matthew Jacobi: https://github.com/oppianmatt |
| 160 |
.. _Mark Joshua Tan: https://github.com/mark-tan |
| 161 |
|
| 162 |
1.1.2 - 2015.07.06 |
| 163 |
------------------ |
| 164 |
|
| 165 |
* Fix for HTML-only emails. Thanks `gnarvaja`_. |
| 166 |
|
| 167 |
.. _gnarvaja: https://github.com/gnarvaja |
| 168 |
|
| 169 |
1.1.1 - 2015.03.20 |
| 170 |
------------------ |
| 171 |
|
| 172 |
* Fix for backward compatibility of task kwarg handling - Thanks `Jeremy Thurgood`_. |
| 173 |
|
| 174 |
.. _Jeremy Thurgood: https://github.com/jerith |
| 175 |
|
| 176 |
1.1.0 - 2015.03.06 |
| 177 |
------------------ |
| 178 |
|
| 179 |
* New PyPI release rolling up 1.0.5 changes and some cleanup. |
| 180 |
* More backward compatability in task. Will still accept message objects and lists of message objects. |
| 181 |
* Thanks again to everyone who contributed to 1.0.5. |
| 182 |
|
| 183 |
1.0.5 - 2014.08.24 |
| 184 |
------------------ |
| 185 |
|
| 186 |
* Django 1.6 support, Travis CI testing, chunked sending & more - thanks `Jonas Haag`_. |
| 187 |
* HTML email support - thanks `Andres Riancho`_. |
| 188 |
* Support for JSON transit for Celery, sponsored by `DigiACTive`_. |
| 189 |
* Drop support for Django 1.2. |
| 190 |
|
| 191 |
.. _`Jonas Haag`: https://github.com/jonashaag |
| 192 |
.. _`Andres Riancho`: https://github.com/andresriancho |
| 193 |
.. _`DigiACTive`: https://github.com/digiactive |
| 194 |
|
| 195 |
1.0.4 - 2013.10.12 |
| 196 |
------------------ |
| 197 |
|
| 198 |
* Add Django 1.5.2 and Python 3 support. |
| 199 |
* Thanks to `Stefan Wehrmeyer`_ for the contribution. |
| 200 |
|
| 201 |
.. _`Stefan Wehrmeyer`: https://github.com/stefanw |
| 202 |
|
| 203 |
1.0.3 - 2012.03.06 |
| 204 |
------------------ |
| 205 |
|
| 206 |
* Backend will now pass any kwargs with which it is initialized to the |
| 207 |
email sending backend. |
| 208 |
* Thanks to `Fedor Tyurin`_ for the contribution. |
| 209 |
|
| 210 |
.. _`Fedor Tyurin`: https://bitbucket.org/ftyurin |
| 211 |
|
| 212 |
|
| 213 |
1.0.2 - 2012.02.21 |
| 214 |
------------------ |
| 215 |
|
| 216 |
* Task and backend now accept kwargs that can be used in signal handlers. |
| 217 |
* Task now returns the result from the email sending backend. |
| 218 |
* Thanks to `Yehonatan Daniv`_ for these changes. |
| 219 |
|
| 220 |
.. _`Yehonatan Daniv`: https://bitbucket.org/ydaniv |
| 221 |
|
| 222 |
1.0.1 - 2011.10.06 |
| 223 |
------------------ |
| 224 |
|
| 225 |
* Fixed a bug that resulted in tasks that were throwing errors reporting success. |
| 226 |
* If there is an exception thrown by the sending email backend, the result of the task will |
| 227 |
now be this exception. |
| 228 |
|
| 229 |
Platform: any |
| 230 |
Classifier: Development Status :: 5 - Production/Stable |
| 231 |
Classifier: Framework :: Django |
| 232 |
Classifier: Operating System :: OS Independent |
| 233 |
Classifier: Programming Language :: Python |
| 234 |
Classifier: Programming Language :: Python :: 3 |
| 235 |
Classifier: Programming Language :: Python :: 3.5 |
| 236 |
Classifier: Programming Language :: Python :: 3.6 |
| 237 |
Classifier: Programming Language :: Python :: 3.7 |
| 238 |
Classifier: Programming Language :: Python :: 3.8 |
| 239 |
Classifier: Intended Audience :: Developers |
| 240 |
Classifier: License :: OSI Approved :: BSD License |
| 241 |
Classifier: Operating System :: POSIX |
| 242 |
Classifier: Topic :: Communications |
| 243 |
Classifier: Topic :: Communications :: Email |
| 244 |
Classifier: Topic :: System :: Distributed Computing |
| 245 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |