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.8.tar.gz (9.7 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.8-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markdown_merge-0.1.8.tar.gz
  • Upload date:
  • Size: 9.7 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.8.tar.gz
Algorithm Hash digest
SHA256 d8aa403b9e678fbc726c69c87c9111c93821fc3ffc1ce143a82e40eff01f10a4
MD5 60fde743b002a125da87ca4011359844
BLAKE2b-256 518156c9ba78fe5b80f15d5f942fd8a497f9fb584e5d1e8ccdbfac54003a7cee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: markdown_merge-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5e1f88cd3187bb3513e359d1c51e3fb0f0d309bdd57e2069d361a1af24ff037b
MD5 c02d593dbdf513103831244ef1429fce
BLAKE2b-256 a7b6f49199ae78cc3c7419ee9261270dab942ce558d69a2676bfe523b9b07b71

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