E-mail with text and html content provided with markdown
Project description
Purpose
Send e-mails with generated html content.
The content has to be written in Markdown syntax. The text part of the e-mail will be filled verbatim; the html part will be a converted HTML from the Markdown content.
Install
$ pip install markdownmail
Basic Usage
import markdownmail
CONTENT = u"""
SPAMS AND EGGS
==============
This is a demo with a list:
1. Spam
2. Second spam
3. ...and eggs
"""
email = markdownmail.MarkdownMail(
from_addr=(u'alice@example.com', u'Alice'),
to_addr=(u'bob@example.com', u'Bob'),
subject=u'MarkdownMail demo',
content=CONTENT
)
email.send('localhost')
Content must be unicode.
Run tests
Tox is automatically installed in virtualenvs before executing the tests. Execute them with:
$ python setup.py test
Disable markdownmail in your tests
If an instance of NullServer is passed to send() method, the e-mail is not send:
email = markdownmail.MarkdownMail(
#params
)
email.send(markdownmail.NullServer())
Subclassing NullServer allows to provide a custom behaviour for the send() method.
Useful links
Envelopes library: https://pypi-hypernode.com/pypi/Envelopes/0.4
Markdown syntax: https://daringfireball.net/projects/markdown/syntax
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for markdownmail-0.4.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c40fa0858a65db59c2dcaa51e0c292dc8189f4c01e20db713bad300e8fb639ba |
|
MD5 | 2348cd5da0e47a1c55f1bf8054c0e642 |
|
BLAKE2b-256 | d81140d07acb5d6140c1e0bdf170ab4957cb110b9c400969e2de4f4d5e21cfba |