





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Information about python-emails, a Python library for handling HTML emails. It includes features such as HTML-email message abstraction, DKIM signature, message loaders, and the ability to send emails directly or via Django email backend. The document also covers examples of creating and sending emails, transforming HTML bodies, and loading messages from various sources.
Typology: Study Guides, Projects, Research
1 / 29
This page cannot be seen from the preview
Don't miss anything!
m = emails.Message(html=T("
Build passed: {{ project_name }} <img src= ˓→'cid:icon.png'> ..."), 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", "rb ˓→")) 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, ]:
...
r = message.send(to=('John Brown', 'jbrown@gmail.com'), render={'name': 'John'}, smtp={'host':'smtp.mycompany.com', 'port': 465, 'ssl': True, 'user': ˓→'john', 'password': '***'}) assert r.status_code == 250
from emails.django import DjangoMessage as Message message = Message(...) message.send(mail_to=('John Brown', 'jbrown@gmail.com'), context={'name': 'John'})
import emails.loader message = emails.loader.from_url(url="http://xxx.github.io/newsletter/2015-08-14/ ˓→index.html")
message = emails.loader.from_zipfile(open('design_pack.zip', 'rb')) message = emails.loader.from_directory('/home/user/design_pack')
message = emails.loader.from_rfc822(open('message.eml').read())
$ [sudo] pip install emails
$ [sudo] add-apt-repository ppa:lavrme/python-emails-ppa $ [sudo] apt-get update $ [sudo] apt-get install python-emails