Skip to main content

Send email using markdown

Project description

MarkdownMerge

Install

pip install markdown_merge

How to use

Provide your SMTP server settings, e.g. for AWS SES

import os
servernm = 'email-smtp.us-west-2.amazonaws.com'
username = os.getenv('SES_SMTP_USER')
password = os.getenv('SES_SMTP_PASS')
smtp_cfg = dict(host=servernm, port=587, user=username, password=password, use_ssl=False, use_tls=True)

You can configure your SMTP server settings using the smtp_cfg dictionary format shown above. The example uses AWS SES with environment variables for credentials.

Provide your email details

from_addr = get_addr('XXX@fastmail.com', 'Jeremy Howard')
to_addrs = [get_addr('douglas@example.com', 'Douglas Adams'),
            get_addr('cleese@example.com', 'John Cleese')]
inserts  = [{'special': "Thanks for all the fish."},
            {'special': "That was a silly walk."}]

msg = """## Hello there!

Here is your special message: *{special}*"""
ml = MarkdownMerge(to_addrs, from_addr, 'A message', msg, smtp_cfg=smtp_cfg, inserts=inserts, test=True)

The test=True parameter prints the messages instead of sending them.

Send your messages

ml.send_msgs()
To: Douglas Adams <douglas@example.com>
----------------------------------------
## Hello there!

Here is your special message: *Thanks for all the fish.*
========================================

To: John Cleese <cleese@example.com>
----------------------------------------
## Hello there!

Here is your special message: *That was a silly walk.*
========================================

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

markdown_merge-0.1.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

markdown_merge-0.1.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file markdown_merge-0.1.5.tar.gz.

File metadata

  • Download URL: markdown_merge-0.1.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for markdown_merge-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e8ac393802b9f33b25d722718aa286846ab22983bc47373ec84fcaee76ee718d
MD5 5e41384424a0e50d44ea08904c64368a
BLAKE2b-256 9d4088ecfcbcd69468270602448341795125f5dda2b74ca4a5ba232c8f06fcca

See more details on using hashes here.

File details

Details for the file markdown_merge-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: markdown_merge-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for markdown_merge-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7c1f2cde426dafd7d282a8991161ece7499a100767a9196fbc948be2726c5948
MD5 8117963269c0742b50f6ba2846c51c5c
BLAKE2b-256 c53f4012c5c7e3dd5ca567577dcb5c096c1ca8abfdfcdcf88d95f1a7ee4de150

See more details on using hashes here.

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