Metadata-Version: 2.1
Name: dmdm
Version: 2.0.1
Summary: Django MarkDown Mails
Home-page: https://github.com/nim65s/dmdm
License: BSD-2-Clause
Author: Guilhem Saurel
Author-email: guilhem.saurel@laas.fr
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: Django (>=2.2,<5.0)
Requires-Dist: black (>=22.10.0,<23.0.0)
Requires-Dist: nmdmail (>=0.3.0,<0.4.0)
Project-URL: Repository, https://github.com/nim65s/dmdm.git
Project-URL: changelog, https://github.com/nim65s/dmdm/blob/master/CHANGELOG.md
Description-Content-Type: text/markdown

#  Django MarkDown Mail

[![PyPI version](https://badge.fury.io/py/dmdm.svg)](https://pypi.org/project/dmdm)
[![Tests](https://github.com/nim65s/dmdm/actions/workflows/test.yml/badge.svg)](https://github.com/nim65s/dmdm/actions/workflows/test.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/nim65s/dmdm/master.svg)](https://results.pre-commit.ci/latest/github/nim65s/dmdm/master)
[![codecov](https://codecov.io/gh/nim65s/dmdm/branch/master/graph/badge.svg?token=CUHNXAVJPO)](https://codecov.io/gh/nim65s/dmdm)
[![Maintainability](https://api.codeclimate.com/v1/badges/6737a84239590ddc0d1e/maintainability)](https://codeclimate.com/github/nim65s/dmdm/maintainability)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Write your email in markdown, and send them in txt & html.

## Requirements

- Python 3.7+
- Django 2.0+
- [nmdmail](https://github.com/nim65s/nmdmail)

## Install

`python -m pip install dmdm`

## Usage

This replaces django's `django.core.email.send_mail`, but the mail will have an html alternative rendered from the text
part with markdown. You can also provide a custom `css` and even images (that will be inlined) located in `image_root`.


```python
from dmdm import send_mail

def send_mail(
    subject: str,
    message: str,
    from_email: str,
    recipient_list: List[str],
    context: Optional[Dict] = None,
    request: Optional[HttpRequest] = None,
    fail_silently: bool = False,
    css: Optional[str] = None,
    image_root: str = ".",
    auth_user: Optional[str] = None,
    auth_password: Optional[str] = None,
    connection: Optional[BaseEmailBackend] = None,
    reply_to: Optional[List[str]] = None,
) -> int
```

If you want to write your markdown in a template, just put the name of the template in `message` and add a `context`
(which can be `{}`) and eventually a `request`:

```python
send_mail(
    subject,
    "test_email_template.md",
    from_email,
    recipient_list,
    {"template_variable": "value"},
)
```

