=============================
Django Mail Admin
=============================
.. image:: https://badge.fury.io/py/django_mail_admin.svg
:target: https://badge.fury.io/py/django_mail_admin
.. image:: https://travis-ci.org/Bearle/django_mail_admin.svg?branch=master
:target: https://travis-ci.org/Bearle/django_mail_admin
.. image:: https://codecov.io/gh/delneg/django_mail_admin/branch/master/graph/badge.svg
:target: https://codecov.io/gh/delneg/django_mail_admin
The one and only django app to receive & send mail with templates and multiple configurations.
Screenshots
-----------
.. image:: https://github.com/Bearle/django_mail_admin/blob/master/screenshots/1.jpg?raw=true
.. image:: https://github.com/Bearle/django_mail_admin/blob/master/screenshots/2.jpg?raw=true
Features
--------
* Everything django-mailbox has
* Everything django-post-office has
* Everything django-db-email-backend has
* Database configurations - activate an outbox to send from, activate a mailbox to receive from
* Templates
* Translatable
* Mailings - using send_many() or 'cc' and 'bcc' or even recipients - all of those accept comma-separated lists of emails
Dependencies
============
* `django >= 1.9 <http://djangoproject.com/>`_
* `django-jsonfield <https://github.com/bradjasper/django-jsonfield>`_
Documentation
-------------
The full documentation is at https://django-mail-admin.readthedocs.io.
Quickstart
----------
**Q**: What versions of Django/Python are supported?
**A**: Take a look at https://travis-ci.org/delneg/django_mail_admin
Install django mail admin::
pip install django_mail_admin
Add it to your `INSTALLED_APPS`:
.. code-block:: python
INSTALLED_APPS = (
...
'django_mail_admin',
...
)
* Run ``migrate``::
python manage.py migrate django_mail_admin
* Set ``django_mail_admin.backends.CustomEmailBackend`` as your ``EMAIL_BACKEND`` in django's ``settings.py``::
EMAIL_BACKEND = 'django_mail_admin.backends.CustomEmailBackend'
* Set cron/Celery/RQ job to send/receive email, e.g. ::
* * * * * (cd $PROJECT; python manage.py send_queued_mail --processes=1 >> $PROJECT/cron_mail.log 2>&1)
* * * * * (cd $PROJECT; python manage.py get_new_mail >> $PROJECT/cron_mail_receive.log 2>&1)
0 1 * * * (cd $PROJECT; python manage.py cleanup_mail --days=30 >> $PROJECT/cron_mail_cleanup.log 2>&1)
.. note::
Once you have entered a mailbox to receive emails, you can easily verify that you
have properly configured your mailbox by either:
* From the Django Admin, using the 'Get New Mail' action from the action
dropdown on the Mailbox changelist
* *Or* from a shell opened to your project's directory, using the
``get_new_mail`` management command by running::
python manage.py get_new_mail
If you have also configured the Outbox, you can verify that it is working, e.g. ::
from django_mail_admin import mail, models
mail.send(
'from@example.com',
'recipient@example.com', # List of email addresses also accepted
subject='My email',
message='Hi there!',
priority=models.PRIORITY.now,
html_message='Hi <strong>there</strong>!',
)
Custom Email Backends
---------------------
By default, ``django_mail_admin`` uses custom Email Backends that looks up for Outbox models in database. If you want to
use a different backend, you can do so by configuring ``BACKENDS``, though you will not be able to use Outboxes and will have to set EMAIL_HOST etc. in django's ``settings.py``.
For example if you want to use `django-ses <https://github.com/hmarr/django-ses>`_::
DJANGO_MAIL_ADMIN = {
'BACKENDS': {
'default': 'django_mail_admin.backends.CustomEmailBackend',
'smtp': 'django.core.mail.backends.smtp.EmailBackend',
'ses': 'django_ses.SESBackend',
}
}
You can then choose what backend you want to use when sending mail:
.. code-block:: python
# If you omit `backend_alias` argument, `default` will be used
mail.send(
'from@example.com',
['recipient@example.com'],
subject='Hello',
)
# If you want to send using `ses` backend
mail.send(
'from@example.com',
['recipient@example.com'],
subject='Hello',
backend='ses',
)
Capture outgoing emails into Outbox
-----------------------------------
If you want to store outgoing emails in the Outbox before they are submitted
to the backend, set ``django_mail_admin.backends.OutboxEmailBackend`` as your
``EMAIL_BACKEND`` in django's ``settings.py``::
EMAIL_BACKEND='django_mail_admin.backends.OutboxEmailBackend'
Emails submitted using ``django.core.mail.send_mail`` will be stored in
the Outbox with the default backend selected for use when sending.
The emails will remain in the Outbox until ``send_queued_mail`` is run.
This can be used on development and test environments to capture emails
so they are not sent automatically, and can be reviewed in Django Admin
to ensure the contents are correct.
Optional requirements
---------------------
1. `django_admin_row_actions` for some useful actions in the admin interface
2. `requests` & `social-auth-app-django` for Gmail
FAQ
---
**Q**: Why did you write this?
**A**: In order to get both email sending & receiving you'll have to install post_office AND django_mailbox.
Even if you do, you'll have to work on admin interface for it to look prettier, somehow link replies properly etc.
So I've decided merging those two and clearing the mess in between them as well as adding some other useful features.
**Q**: Why did you remove support for Python 2?
**A**: Because f*ck python2. Really, it's been 9 (NINE!) years since it came out. Go ahead and check out https://github.com/brettcannon/caniusepython3
**Q**: Why is it named django_mail_admin, what does it have to do with admin ?
**A**: Well, the first version of this package (which was living just in a really large admin.py) was used for easy mail management using standard Django admin interface.
**Q**: What languages are available?
**A**: Currently there's Russian and English languages available. Feel free to add yours:
::
source <YOURVIRTUALENV>/bin/activate
python manage.py makemessages -l YOUR_LOCALE -i venv
python manage.py compilemessages -l YOUR_LOCALE
**Q**: Why did you delete support for multi-lingual templates?
**A**: Well, we have django-model-translations for that. You can easily fork this app and override EmailTemplate model (models/templates.py) accordingly.
I think there's no need for such an overhead in a mail-related app.
**Q**: I don't want my outgoing emails to be queued for sending after saving them in the admin interface, what do i do?
**A**: Just override OutgoingEmailAdmin's save_model method.
**Q**: Can i get in touch with you? I want a new feature to be implemented/bug fixed!
**A**: Feel free to reach me out using issues and pull requests, I'll review them all and answer when I can.
Running Tests
-------------
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Credits
-------
Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
Raw data
{
"_id": null,
"home_page": "https://github.com/delneg/django_mail_admin",
"name": "django-mail-admin",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "django_mail_admin",
"author": "Denis Bobrov",
"author_email": "delneg@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/6a/c3/0c793d0f2ef4bd6cccfa9c4a1f98ea5a8c60ef5008e6852a946de25ea334/django_mail_admin-0.3.2.tar.gz",
"platform": null,
"description": "=============================\nDjango Mail Admin\n=============================\n\n.. image:: https://badge.fury.io/py/django_mail_admin.svg\n :target: https://badge.fury.io/py/django_mail_admin\n\n.. image:: https://travis-ci.org/Bearle/django_mail_admin.svg?branch=master\n :target: https://travis-ci.org/Bearle/django_mail_admin\n\n.. image:: https://codecov.io/gh/delneg/django_mail_admin/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/delneg/django_mail_admin\n\nThe one and only django app to receive & send mail with templates and multiple configurations.\n\n\nScreenshots\n-----------\n\n.. image:: https://github.com/Bearle/django_mail_admin/blob/master/screenshots/1.jpg?raw=true\n.. image:: https://github.com/Bearle/django_mail_admin/blob/master/screenshots/2.jpg?raw=true\n\nFeatures\n--------\n\n* Everything django-mailbox has\n* Everything django-post-office has\n* Everything django-db-email-backend has\n* Database configurations - activate an outbox to send from, activate a mailbox to receive from\n* Templates\n* Translatable\n* Mailings - using send_many() or 'cc' and 'bcc' or even recipients - all of those accept comma-separated lists of emails\n\nDependencies\n============\n\n* `django >= 1.9 <http://djangoproject.com/>`_\n* `django-jsonfield <https://github.com/bradjasper/django-jsonfield>`_\n\nDocumentation\n-------------\n\nThe full documentation is at https://django-mail-admin.readthedocs.io.\n\nQuickstart\n----------\n\n**Q**: What versions of Django/Python are supported?\n**A**: Take a look at https://travis-ci.org/delneg/django_mail_admin\n\nInstall django mail admin::\n\n pip install django_mail_admin\n\nAdd it to your `INSTALLED_APPS`:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'django_mail_admin',\n ...\n )\n\n* Run ``migrate``::\n\n python manage.py migrate django_mail_admin\n\n* Set ``django_mail_admin.backends.CustomEmailBackend`` as your ``EMAIL_BACKEND`` in django's ``settings.py``::\n\n EMAIL_BACKEND = 'django_mail_admin.backends.CustomEmailBackend'\n\n\n* Set cron/Celery/RQ job to send/receive email, e.g. ::\n\n * * * * * (cd $PROJECT; python manage.py send_queued_mail --processes=1 >> $PROJECT/cron_mail.log 2>&1)\n * * * * * (cd $PROJECT; python manage.py get_new_mail >> $PROJECT/cron_mail_receive.log 2>&1)\n 0 1 * * * (cd $PROJECT; python manage.py cleanup_mail --days=30 >> $PROJECT/cron_mail_cleanup.log 2>&1)\n\n.. note::\n\n Once you have entered a mailbox to receive emails, you can easily verify that you\n have properly configured your mailbox by either:\n\n * From the Django Admin, using the 'Get New Mail' action from the action\n dropdown on the Mailbox changelist\n * *Or* from a shell opened to your project's directory, using the\n ``get_new_mail`` management command by running::\n\n python manage.py get_new_mail\n\n If you have also configured the Outbox, you can verify that it is working, e.g. ::\n\n from django_mail_admin import mail, models\n\n mail.send(\n 'from@example.com',\n 'recipient@example.com', # List of email addresses also accepted\n subject='My email',\n message='Hi there!',\n priority=models.PRIORITY.now,\n html_message='Hi <strong>there</strong>!',\n )\n\nCustom Email Backends\n---------------------\n\nBy default, ``django_mail_admin`` uses custom Email Backends that looks up for Outbox models in database. If you want to\nuse a different backend, you can do so by configuring ``BACKENDS``, though you will not be able to use Outboxes and will have to set EMAIL_HOST etc. in django's ``settings.py``.\n\nFor example if you want to use `django-ses <https://github.com/hmarr/django-ses>`_::\n\n DJANGO_MAIL_ADMIN = {\n 'BACKENDS': {\n 'default': 'django_mail_admin.backends.CustomEmailBackend',\n 'smtp': 'django.core.mail.backends.smtp.EmailBackend',\n 'ses': 'django_ses.SESBackend',\n }\n }\n\nYou can then choose what backend you want to use when sending mail:\n\n.. code-block:: python\n\n # If you omit `backend_alias` argument, `default` will be used\n mail.send(\n 'from@example.com',\n ['recipient@example.com'],\n subject='Hello',\n )\n\n # If you want to send using `ses` backend\n mail.send(\n 'from@example.com',\n ['recipient@example.com'],\n subject='Hello',\n backend='ses',\n )\n\nCapture outgoing emails into Outbox\n-----------------------------------\n\nIf you want to store outgoing emails in the Outbox before they are submitted\nto the backend, set ``django_mail_admin.backends.OutboxEmailBackend`` as your\n``EMAIL_BACKEND`` in django's ``settings.py``::\n\n EMAIL_BACKEND='django_mail_admin.backends.OutboxEmailBackend'\n\nEmails submitted using ``django.core.mail.send_mail`` will be stored in\nthe Outbox with the default backend selected for use when sending.\n\nThe emails will remain in the Outbox until ``send_queued_mail`` is run.\n\nThis can be used on development and test environments to capture emails\nso they are not sent automatically, and can be reviewed in Django Admin\nto ensure the contents are correct.\n\nOptional requirements\n---------------------\n\n1. `django_admin_row_actions` for some useful actions in the admin interface\n2. `requests` & `social-auth-app-django` for Gmail\n\n\nFAQ\n---\n\n**Q**: Why did you write this?\n\n**A**: In order to get both email sending & receiving you'll have to install post_office AND django_mailbox.\nEven if you do, you'll have to work on admin interface for it to look prettier, somehow link replies properly etc.\nSo I've decided merging those two and clearing the mess in between them as well as adding some other useful features.\n\n**Q**: Why did you remove support for Python 2?\n\n**A**: Because f*ck python2. Really, it's been 9 (NINE!) years since it came out. Go ahead and check out https://github.com/brettcannon/caniusepython3\n\n**Q**: Why is it named django_mail_admin, what does it have to do with admin ?\n\n**A**: Well, the first version of this package (which was living just in a really large admin.py) was used for easy mail management using standard Django admin interface.\n\n**Q**: What languages are available?\n\n**A**: Currently there's Russian and English languages available. Feel free to add yours:\n\n::\n\n source <YOURVIRTUALENV>/bin/activate\n python manage.py makemessages -l YOUR_LOCALE -i venv\n python manage.py compilemessages -l YOUR_LOCALE\n\n\n**Q**: Why did you delete support for multi-lingual templates?\n\n**A**: Well, we have django-model-translations for that. You can easily fork this app and override EmailTemplate model (models/templates.py) accordingly.\nI think there's no need for such an overhead in a mail-related app.\n\n**Q**: I don't want my outgoing emails to be queued for sending after saving them in the admin interface, what do i do?\n\n**A**: Just override OutgoingEmailAdmin's save_model method.\n\n**Q**: Can i get in touch with you? I want a new feature to be implemented/bug fixed!\n\n**A**: Feel free to reach me out using issues and pull requests, I'll review them all and answer when I can.\n\n\n\nRunning Tests\n-------------\n\nDoes the code actually work?\n\n::\n\n source <YOURVIRTUALENV>/bin/activate\n (myenv) $ pip install tox\n (myenv) $ tox\n\nCredits\n-------\n\nTools used in rendering this package:\n\n* Cookiecutter_\n* `cookiecutter-djangopackage`_\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The one and only django app to receive & send mail with templates and multiple configurations.",
"version": "0.3.2",
"project_urls": {
"Homepage": "https://github.com/delneg/django_mail_admin"
},
"split_keywords": [
"django_mail_admin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68f6cadbf399f13e43d5fe4e77bdf75681a0031b997c511a22bb9ce1adbfcee4",
"md5": "893491580c7ef87e647dac0acd2e911e",
"sha256": "1eec265a266d8917721beca3df32a6daa0fffd816e16f53e65a4c8bfdea94587"
},
"downloads": -1,
"filename": "django_mail_admin-0.3.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "893491580c7ef87e647dac0acd2e911e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 51666,
"upload_time": "2023-08-03T11:50:38",
"upload_time_iso_8601": "2023-08-03T11:50:38.344182Z",
"url": "https://files.pythonhosted.org/packages/68/f6/cadbf399f13e43d5fe4e77bdf75681a0031b997c511a22bb9ce1adbfcee4/django_mail_admin-0.3.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ac30c793d0f2ef4bd6cccfa9c4a1f98ea5a8c60ef5008e6852a946de25ea334",
"md5": "0f237360d6024670b525682c2b382656",
"sha256": "7403352c99d47e15c34c51a4ef3c19a113f237ba81b010b1e5ae5a8406ea5c84"
},
"downloads": -1,
"filename": "django_mail_admin-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "0f237360d6024670b525682c2b382656",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 41540,
"upload_time": "2023-08-03T11:50:40",
"upload_time_iso_8601": "2023-08-03T11:50:40.555879Z",
"url": "https://files.pythonhosted.org/packages/6a/c3/0c793d0f2ef4bd6cccfa9c4a1f98ea5a8c60ef5008e6852a946de25ea334/django_mail_admin-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-03 11:50:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "delneg",
"github_project": "django_mail_admin",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"requirements": [
{
"name": "jsonfield",
"specs": []
},
{
"name": "social-auth-app-django",
"specs": []
}
],
"tox": true,
"lcname": "django-mail-admin"
}