dmdm


Namedmdm JSON
Version 2.0.3 PyPI version JSON
download
home_pagehttps://github.com/nim65s/dmdm
SummaryDjango MarkDown Mails
upload_time2023-02-05 11:23:17
maintainer
docs_urlNone
authorGuilhem Saurel
requires_python>=3.7,<4.0
licenseBSD-2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            #  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"},
)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nim65s/dmdm",
    "name": "dmdm",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Guilhem Saurel",
    "author_email": "guilhem.saurel@laas.fr",
    "download_url": "https://files.pythonhosted.org/packages/f7/3e/5265900a5cdc26a778138ca40e394fed7277bb70e1840d5123ec9d67c10f/dmdm-2.0.3.tar.gz",
    "platform": null,
    "description": "#  Django MarkDown Mail\n\n[![PyPI version](https://badge.fury.io/py/dmdm.svg)](https://pypi.org/project/dmdm)\n[![Tests](https://github.com/nim65s/dmdm/actions/workflows/test.yml/badge.svg)](https://github.com/nim65s/dmdm/actions/workflows/test.yml)\n[![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)\n[![codecov](https://codecov.io/gh/nim65s/dmdm/branch/master/graph/badge.svg?token=CUHNXAVJPO)](https://codecov.io/gh/nim65s/dmdm)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6737a84239590ddc0d1e/maintainability)](https://codeclimate.com/github/nim65s/dmdm/maintainability)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nWrite your email in markdown, and send them in txt & html.\n\n## Requirements\n\n- Python 3.7+\n- Django 2.0+\n- [nmdmail](https://github.com/nim65s/nmdmail)\n\n## Install\n\n`python -m pip install dmdm`\n\n## Usage\n\nThis replaces django's `django.core.email.send_mail`, but the mail will have an html alternative rendered from the text\npart with markdown. You can also provide a custom `css` and even images (that will be inlined) located in `image_root`.\n\n\n```python\nfrom dmdm import send_mail\n\ndef send_mail(\n    subject: str,\n    message: str,\n    from_email: str,\n    recipient_list: List[str],\n    context: Optional[Dict] = None,\n    request: Optional[HttpRequest] = None,\n    fail_silently: bool = False,\n    css: Optional[str] = None,\n    image_root: str = \".\",\n    auth_user: Optional[str] = None,\n    auth_password: Optional[str] = None,\n    connection: Optional[BaseEmailBackend] = None,\n    reply_to: Optional[List[str]] = None,\n) -> int\n```\n\nIf you want to write your markdown in a template, just put the name of the template in `message` and add a `context`\n(which can be `{}`) and eventually a `request`:\n\n```python\nsend_mail(\n    subject,\n    \"test_email_template.md\",\n    from_email,\n    recipient_list,\n    {\"template_variable\": \"value\"},\n)\n```\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "Django MarkDown Mails",
    "version": "2.0.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25a7c7b44c3268ed71e96fa74b55e4217b2358d4c08165cf38573b8391484050",
                "md5": "73efc3b82432ed593ba5b463803c8053",
                "sha256": "c8efa86d7a6c11d997d38167e0af2ad4082796b0971b5adf0d03eddc888473a3"
            },
            "downloads": -1,
            "filename": "dmdm-2.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "73efc3b82432ed593ba5b463803c8053",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 3839,
            "upload_time": "2023-02-05T11:23:16",
            "upload_time_iso_8601": "2023-02-05T11:23:16.029875Z",
            "url": "https://files.pythonhosted.org/packages/25/a7/c7b44c3268ed71e96fa74b55e4217b2358d4c08165cf38573b8391484050/dmdm-2.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f73e5265900a5cdc26a778138ca40e394fed7277bb70e1840d5123ec9d67c10f",
                "md5": "e7d5d9b6eec3c8d1731a893dcd563d05",
                "sha256": "b3be786df928d5a591868240d698a6579f4ef4cfbd2d5c3c07d13687c82cb5f2"
            },
            "downloads": -1,
            "filename": "dmdm-2.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e7d5d9b6eec3c8d1731a893dcd563d05",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 3748,
            "upload_time": "2023-02-05T11:23:17",
            "upload_time_iso_8601": "2023-02-05T11:23:17.280457Z",
            "url": "https://files.pythonhosted.org/packages/f7/3e/5265900a5cdc26a778138ca40e394fed7277bb70e1840d5123ec9d67c10f/dmdm-2.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-05 11:23:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "nim65s",
    "github_project": "dmdm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dmdm"
}
        
Elapsed time: 0.14905s