All Projects → jph00 → markdown_merge

jph00 / markdown_merge

Licence: Apache-2.0 license
Send email using markdown

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language
Makefile
30231 projects

MarkdownMerge

Send templated emails in markdown.

Install

pip install markdown_merge

How to use

Provide your SMTP server settings, e.g. for fastmail

cfg = dict(EMAIL_HOST='smtp.fastmail.com', EMAIL_PORT=465,
    EMAIL_HOST_USER='[email protected]', EMAIL_HOST_PASSWORD='XXX', EMAIL_USE_SSL=True)

Alternately you can put your server settings in mail_settings.py. There's an example settings file in the repo.

Provide your email details

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=msg, inserts=inserts)

Optionally, enable test mode to just print the messages, instead of sending them.

ml.set_test(True)

Send your messages

ml.send_msgs()

Credits

All the hard work is done by Django mail, python-markdown, and python. So thanks to the authors of those projects!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].