MarkdownMail
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.org',
to_addr=u'bob@example.org',
subject=u'MarkdownMail demo',
content=CONTENT
)
email.send('localhost')
Content must be unicode.
More infos
Additional informations are addable:
email = markdownmail.MarkdownMail(
from_addr=(u'alice@example.org', u'Alice'),
to_addr=(u'bob@example.org', u'Bob'),
subject=u'MarkdownMail demo',
content=CONTENT
)
cc_addr and bcc_addr are optional.
The from_addr, to_addr, cc_addr and bcc_addr parameters are the same as
Enveloppe library.
Change SMTP port:
email.send("example.org", port=3325)
Change SMTP login and password:
email.send("example.org", login="user", password="password")
Use TLS:
email.send("example.org", tls=True)
Style
A default CSS is automatically added to the e-mail. It includes a font sans serif and minor improvements.
To override the default CSS, pass a string including the style to the css optional parameter of MardownMail:
import markdownmail
email = markdownmail.MarkdownMail(
from_addr=u'alice@example.org',
to_addr=u'bob@example.org',
subject=u'MarkdownMail demo',
content="CONTENT",
css="font-family:monospace; color:green;"
)
Run tests
Tox is automatically installed in virtualenvs before executing the tests. Execute them with:
$ python setup.py test
Disable sending e-mails in your tests
The e-mail is not send if the parameter passed to send() method is an instance of NullServer.
email = markdownmail.MarkdownMail(
#params
)
email.send(markdownmail.NullServer())
Assert about e-mails in your tests
Subclassing NullServer allows to provide a custom behaviour in the check()
method:
class MyServer(markdownmail.NullServer):
def check(self, email):
assert u'bob@example.org' == email.to_addr[0]
email.send(MyServer())
Useful links
Envelopes library (MardownMail is a wrapper around Envelopes library.)
Metadata
Release files for markdownmail 0.11.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| markdownmail-0.11.1.tar.gz | 7.9 kB | Without provenance | Details for markdownmail-0.11.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markdownmail-0.11.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for markdownmail-0.11.1-py2.py3-none-any.whl |
Total release size: 16.5 kB
Release files / markdownmail-0.11.1.tar.gz
| Download URL | markdownmail-0.11.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb33fdadf9961254f6ab16c09adf08474615f392c8429d42da825f9c42a8db68
|
|
BLAKE2b-256 checksum How to use checksums |
a85fefbc0edc1bd7cf1ae3a04be2862085bdeb4b7561f1c0d407a2535d8b9f94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / markdownmail-0.11.1-py2.py3-none-any.whl
| Download URL | markdownmail-0.11.1-py2.py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
20a27ab4c1db22712bc10055ae2474030b949903cdceeeea83bf2f7fd7723259
|
|
BLAKE2b-256 checksum How to use checksums |
4f03c1c2dd388ea0bde6a187479ef71ab838543c9058748875e703877dde5e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for markdownmail 0.11.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.