#hide
from markdown_merge.markdown_merge import *
pip install markdown_merge
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.
from_addr = get_addr('[email protected]', 'Jeremy Howard')
to_addrs = [get_addr('[email protected]', 'Douglas Adams'),
get_addr('[email protected]', '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.
ml.send_msgs()
To: Douglas Adams <[email protected]>
----------------------------------------
## Hello there!
Here is your special message: *Thanks for all the fish.*
========================================
To: John Cleese <[email protected]>
----------------------------------------
## Hello there!
Here is your special message: *That was a silly walk.*
========================================