Skip to main content

Django MarkDown Mails

Project description

Django MarkDown Mail

PyPI version Tests pre-commit.ci status codecov Maintainability Code style: black

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

Requirements

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.

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dmdm-3.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dmdm-3.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file dmdm-3.1.0.tar.gz.

File metadata

  • Download URL: dmdm-3.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dmdm-3.1.0.tar.gz
Algorithm Hash digest
SHA256 360e37547456d58e33340562ff0d4285427e6c0a598fde818fbe42e8ea838df7
MD5 68bc58e997c8ec5677b96e4dc3d5cfd2
BLAKE2b-256 b2deca7bc92c3911a832b2a8f4e42dc39558290bd019400953cd1cae68cfd5b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for dmdm-3.1.0.tar.gz:

Publisher: release.yml on nim65s/dmdm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dmdm-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: dmdm-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dmdm-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38b95055df0c0195f4a02dffc1db73ba7984a56310b66210a5d0cd271088e90f
MD5 208a4d96188aa207a60da9761489d5b7
BLAKE2b-256 a84c8f1cd3d58c8a22deb006a33cc4f6566c076bf6118313eb07224d2f2bf8b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for dmdm-3.1.0-py3-none-any.whl:

Publisher: release.yml on nim65s/dmdm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page