## Django Debug Toolbar - Mail Panel
[![Build Status](https://secure.travis-ci.org/scuml/django-mail-panel.png?branch=master)](http://travis-ci.org/scuml/django-mail-panel)
![](https://cloud.githubusercontent.com/assets/1790447/9289964/6aa7c4ba-434e-11e5-8594-3bb3efd0cd81.png)
Testing and debugging e-mail while developing a Django app has never been pleasant. Sending e-mail to a file-based backend requires a user to click through obtusely-named files and does not provide a way to preview rendered HTML. Sending e-mail to a valid mailbox incurs a delay as the message is processed though a mail server, and clutters a developer's inbox.
The mail panel attempts to address these problems by providing a way to preview emails within the browser using [django-debug-toolbar](https://github.com/jazzband/django-debug-toolbar).
This mail panel is released under the Apache license. If you like it, please consider contributing!
Special thanks to @ShawnMilo for the code review.
Installation
============
To install the mail panel, first install this package with `pip install django-mail-panel`. Then add the `mail_panel` app after `debug_toolbar`to the `INSTALLED_APPS` setting:
```python
INSTALLED_APPS = (
...
'debug_toolbar',
'mail_panel',
)
```
and add the panel `DEBUG_TOOLBAR_PANELS`:
```python
DEBUG_TOOLBAR_PANELS = (
...
'mail_panel.panels.MailToolbarPanel',
)
```
Collect static and you'll be good to go.
```bash
./manage.py collectstatic
```
Configuration
=============
After installation, you now need to redirect mail to the mail toolbar. Change your email backend to the following:
```python
EMAIL_BACKEND = 'mail_panel.backend.MailToolbarBackend'
```
**Important:** This plugin uses Django's cache backend to store messages. If you are using `DummyCache`, the mail panel will use a local memory cache, and will reset messages when the server is restarted.
**[Optional]**
By default, mail toolbar stores messages for one day before removing them from cache. You can change this with the following setting:
```python
MAIL_TOOLBAR_TTL = 86400 # 1 Day
```
**[Optional]**
If you use the `DEBUG_TOOLBAR_PANELS` to custom order your panels:
```python
DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.history.HistoryPanel",
"debug_toolbar.panels.versions.VersionsPanel",
"debug_toolbar.panels.timer.TimerPanel",
"debug_toolbar.panels.settings.SettingsPanel",
"debug_toolbar.panels.headers.HeadersPanel",
"debug_toolbar.panels.request.RequestPanel",
"debug_toolbar.panels.sql.SQLPanel",
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
"debug_toolbar.panels.templates.TemplatesPanel",
"debug_toolbar.panels.cache.CachePanel",
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
"mail_panel.panels.MailToolbarPanel", # reposition to desired location
]
```
Testing
=======
To preview emails sent from your test suite, add the email backend override to your tests with the following:
```python
from django.test.utils import override_settings
@override_settings(EMAIL_BACKEND='mail_panel.backend.MailToolbarBackend')
def test_send_email(self):
# your code here
```
The backend works similarly to the standard email backend and code should not need to be reworked when using the MailToolbarBackend.
```python
from django.core import mail
original_outbox = len(mail.outbox)
# Send mail ...
assert(len(mail.outbox) == original_outbox + 1)
```
Shameless Plugs
=======
Like Django Mail Panel? Be sure to check out and support these other tools for Mac that will improve your workflow:
**[Kubermagic](https://echodot.com/kubermagic/)** - Automate, and script away tedious kubectl commands with Kubermagic; a UI for developers, QA teams, and those starting to learn the ins-and-outs of Kubernetes.
**[Red](https://echodot.com/red/)** - A visual and interactive Redis client, featuring live updating keys, an interactive console, pub/sub, lua script support and much more.
Raw data
{
"_id": null,
"home_page": "https://github.com/scuml/django-mail-panel",
"name": "django-mail-panel",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.5",
"maintainer_email": null,
"keywords": "django, django-debug-toolbar, mail",
"author": "Stephen Mitchell",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/db/a2/7d33feae8e1ed1470c0c944a2974fd4d1a48503ec9d944e997d92a9096af/django_mail_panel-4.0.4.tar.gz",
"platform": null,
"description": "\n## Django Debug Toolbar - Mail Panel\n\n[![Build Status](https://secure.travis-ci.org/scuml/django-mail-panel.png?branch=master)](http://travis-ci.org/scuml/django-mail-panel)\n\n![](https://cloud.githubusercontent.com/assets/1790447/9289964/6aa7c4ba-434e-11e5-8594-3bb3efd0cd81.png)\n\n\nTesting and debugging e-mail while developing a Django app has never been pleasant. Sending e-mail to a file-based backend requires a user to click through obtusely-named files and does not provide a way to preview rendered HTML. Sending e-mail to a valid mailbox incurs a delay as the message is processed though a mail server, and clutters a developer's inbox.\n\nThe mail panel attempts to address these problems by providing a way to preview emails within the browser using [django-debug-toolbar](https://github.com/jazzband/django-debug-toolbar).\n\nThis mail panel is released under the Apache license. If you like it, please consider contributing!\n\nSpecial thanks to @ShawnMilo for the code review.\n\n\nInstallation\n============\n\nTo install the mail panel, first install this package with `pip install django-mail-panel`. Then add the `mail_panel` app after `debug_toolbar`to the `INSTALLED_APPS` setting:\n\n```python\nINSTALLED_APPS = (\n ...\n 'debug_toolbar',\n 'mail_panel',\n)\n```\n\nand add the panel `DEBUG_TOOLBAR_PANELS`:\n\n```python\nDEBUG_TOOLBAR_PANELS = (\n ...\n 'mail_panel.panels.MailToolbarPanel',\n)\n```\n\n\nCollect static and you'll be good to go.\n\n```bash\n./manage.py collectstatic\n```\n\n\nConfiguration\n=============\n\nAfter installation, you now need to redirect mail to the mail toolbar. Change your email backend to the following:\n\n```python\nEMAIL_BACKEND = 'mail_panel.backend.MailToolbarBackend'\n```\n\n**Important:** This plugin uses Django's cache backend to store messages. If you are using `DummyCache`, the mail panel will use a local memory cache, and will reset messages when the server is restarted.\n\n\n**[Optional]** \nBy default, mail toolbar stores messages for one day before removing them from cache. You can change this with the following setting:\n\n```python\nMAIL_TOOLBAR_TTL = 86400 # 1 Day\n```\n\n**[Optional]**\nIf you use the `DEBUG_TOOLBAR_PANELS` to custom order your panels:\n\n```python\n DEBUG_TOOLBAR_PANELS = [\n \"debug_toolbar.panels.history.HistoryPanel\",\n \"debug_toolbar.panels.versions.VersionsPanel\",\n \"debug_toolbar.panels.timer.TimerPanel\",\n \"debug_toolbar.panels.settings.SettingsPanel\",\n \"debug_toolbar.panels.headers.HeadersPanel\",\n \"debug_toolbar.panels.request.RequestPanel\",\n \"debug_toolbar.panels.sql.SQLPanel\",\n \"debug_toolbar.panels.staticfiles.StaticFilesPanel\",\n \"debug_toolbar.panels.templates.TemplatesPanel\",\n \"debug_toolbar.panels.cache.CachePanel\",\n \"debug_toolbar.panels.signals.SignalsPanel\",\n \"debug_toolbar.panels.logging.LoggingPanel\",\n \"debug_toolbar.panels.redirects.RedirectsPanel\",\n \"debug_toolbar.panels.profiling.ProfilingPanel\",\n \"mail_panel.panels.MailToolbarPanel\", # reposition to desired location\n ]\n```\n\n\n\nTesting\n=======\n\nTo preview emails sent from your test suite, add the email backend override to your tests with the following:\n\n```python\nfrom django.test.utils import override_settings\n\n@override_settings(EMAIL_BACKEND='mail_panel.backend.MailToolbarBackend')\ndef test_send_email(self):\n # your code here\n```\n\n\nThe backend works similarly to the standard email backend and code should not need to be reworked when using the MailToolbarBackend.\n\n\n```python\nfrom django.core import mail\n\noriginal_outbox = len(mail.outbox)\n# Send mail ...\nassert(len(mail.outbox) == original_outbox + 1)\n```\n\nShameless Plugs\n=======\nLike Django Mail Panel? Be sure to check out and support these other tools for Mac that will improve your workflow:\n\n**[Kubermagic](https://echodot.com/kubermagic/)** - Automate, and script away tedious kubectl commands with Kubermagic; a UI for developers, QA teams, and those starting to learn the ins-and-outs of Kubernetes. \n\n\n**[Red](https://echodot.com/red/)** - A visual and interactive Redis client, featuring live updating keys, an interactive console, pub/sub, lua script support and much more.\n",
"bugtrack_url": null,
"license": "Apache Software License",
"summary": "A panel for django-debug-toolbar that allows for viewing of recently sent email.",
"version": "4.0.4",
"project_urls": {
"Homepage": "https://github.com/scuml/django-mail-panel",
"Repository": "https://github.com/scuml/django-mail-panel"
},
"split_keywords": [
"django",
" django-debug-toolbar",
" mail"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2bac5ad026422748ec916a269111d7e7cdf9ab36c34711faacaf71ad13d569e0",
"md5": "d74a719649db72cc93e0eba9f971084d",
"sha256": "440fe6c60bedc9bc4c4a2d9931ac9582d81f5d4c7e976eca7a48e8fc2d758a12"
},
"downloads": -1,
"filename": "django_mail_panel-4.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d74a719649db72cc93e0eba9f971084d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.5",
"size": 17263,
"upload_time": "2024-05-09T15:51:17",
"upload_time_iso_8601": "2024-05-09T15:51:17.888575Z",
"url": "https://files.pythonhosted.org/packages/2b/ac/5ad026422748ec916a269111d7e7cdf9ab36c34711faacaf71ad13d569e0/django_mail_panel-4.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dba27d33feae8e1ed1470c0c944a2974fd4d1a48503ec9d944e997d92a9096af",
"md5": "f2ba9982b9e6d651bfb79572819f7d91",
"sha256": "032c75a9588efe051a758404f2a68cf29b620e024d44cf40acd4a9b6639206fc"
},
"downloads": -1,
"filename": "django_mail_panel-4.0.4.tar.gz",
"has_sig": false,
"md5_digest": "f2ba9982b9e6d651bfb79572819f7d91",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.5",
"size": 15988,
"upload_time": "2024-05-09T15:51:19",
"upload_time_iso_8601": "2024-05-09T15:51:19.166929Z",
"url": "https://files.pythonhosted.org/packages/db/a2/7d33feae8e1ed1470c0c944a2974fd4d1a48503ec9d944e997d92a9096af/django_mail_panel-4.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-09 15:51:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scuml",
"github_project": "django-mail-panel",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "django-mail-panel"
}