Metadata-Version: 2.4
Name: django-local-mail-viewer
Version: 0.0.3
Summary: A local mail viewer for Django development.
Author: Christian Wiegand
License-Expression: MIT
Project-URL: Repository, https://github.com/christianwgd/django-local-mail-viewer
Project-URL: Changelog, https://github.com/christianwiegand/django-local-mail-viewer/blob/main/CHANGELOG.md
Keywords: django,email,develop
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django
Dynamic: license-file

# django-local-mail-viewer

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Run Test](https://github.com/christianwgd/django-local-mail-viewer/actions/workflows/python-test.yml/badge.svg)](https://github.com/christianwgd/django-local-mail-viewer/actions/workflows/python-test.yml)
[![codecov](https://codecov.io/github/christianwgd/django-local-mail-viewer/graph/badge.svg?token=i3jXueSzIY)](https://codecov.io/github/christianwgd/django-local-mail-viewer)
[![PyPI](https://img.shields.io/pypi/v/django-local-mail-viewer)](https://pypi.org/project/django-local-mail-viewer/)

``django-local-mail-viewer``is a Django app that provides a simple email viewer 
for emails during development. It is used together with the email backend 
``django.core.mail.backends.filebased.EmailBackend``. You can browse the emails
from a web interface and view the content of those emails as well as any attachments.

## Documentation

Install via pipy running ``pip install django-local-mail-viewer`` and add 
``django_local_mail_viewer`` to your ``INSTALLED_APPS`` of your development 
settings file or add this for more flexibility:
```
if DEBUG:
    INSTALLED_APPS += ['django_local_mail_viewer']
```

Add ``path('mail/', include('local_mail_viewer.urls'))`` to your ``urls.py``.
This can also be done conditionally:
```
if settings.DEBUG:
    urlpatterns += path('mail/', include('local_mail_viewer.urls'))
```

Set your email config as follows:
```
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
DEFAULT_FROM_EMAIL = 'some_name@some_domain.tld'
EMAIL_FILE_PATH = BASE_DIR / 'sent_emails'
```

You can choose the EMAIL_FILE_PATH to any name, it will be detected automatically.

**Don't use the local mail viewer in production!**

## Usage

Open ``http://localhost:8000/mail/`` in your browser.
