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,
    headers: Optional[Dict[str, 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-4.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

dmdm-4.0.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dmdm-4.0.0.tar.gz
Algorithm Hash digest
SHA256 70ee9761b70ce46e3b2d019cf91b96c6503bd6ddbf7f951638b7a03775199017
MD5 e70361243e5e3754b59b35fabf7154c5
BLAKE2b-256 f8ccde0acce342eb824bbc178f3d6474754ae79d721e4b38ab84b0086233036d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dmdm-4.0.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-4.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dmdm-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fafe666e015df1a61fcded47d24c5fe9ffcb866c7001f71a2b351d6e3c6f117
MD5 6405949df0095c087cad7dab58652743
BLAKE2b-256 ef1b6a4202fcd51d418b18358d9c082f200cd961a2878177443087469f7af8b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dmdm-4.0.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