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.4.tar.gz (9.4 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.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markdown_merge-0.1.4.tar.gz
  • Upload date:
  • Size: 9.4 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.4.tar.gz
Algorithm Hash digest
SHA256 2110255cca3400c3854bf5665031771db3ea6edcf880e6adfebb648b7caea8f6
MD5 b9b0c71dd9ceebb5763c890db3eb98cd
BLAKE2b-256 a6a3588557086ab0586572b4b9cc9271bbb08be744f3f59b0bf919ec93341048

See more details on using hashes here.

File details

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

File metadata

  • Download URL: markdown_merge-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e867c36659da6e3001cba17df41bee4477af2b13573505033c75b0df84942047
MD5 5c5e2bd1a1920ac937f917ad1083c13d
BLAKE2b-256 ba22bca3865f2c7fcd2d7b2413834db6b4e9ae9e1d34155fa6f1d3daf163752e

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