python-emails ============= .. module:: emails Modern email handling in python. .. code-block:: python m = emails.Message(html=T("
Build passed: {{ project_name }} ..."),
text=T("Build passed: {{ project_name }} ..."),
subject=T("Passed: {{ project_name }}#{{ build_id }}"),
mail_from=("CI", "ci@mycompany.com"))
m.attach(filename="icon.png", content_disposition="inline", data=open("icon.png"))
response = m.send(render={"project_name": "user/project1", "build_id": 121},
to='somebody@mycompany.com',
smtp={"host":"mx.mycompany.com", "port": 25})
if response.status_code not in [250, ]:
# message is not sent, retry later
...
See `the same code, without Emails