Envelopes is a tiny library I wrote to make working with Python's email and smptlib packages simple and fun.
Envelopes abstracts all the weird stuff about Python's outgoing e-mail tools and makes composing and sending e-mails simple. It supports all the features you'd expect it to support - long and short e-mail addresses, text and HTML bodies, CC and BCC fields, standard and custom headers, file attachments and charsets. Envelopes can be used in Web apps, queue workers and pretty much anywhere you'd use email and smptlib to send e-mails.
Just look at the following example:
from envelopes import Envelope envelope = Envelope( firstname.lastname@example.org', from_name=u'From Example', email@example.com', to_name=u'To Example', subject=u'Envelopes demo', text_body=u"I'm a helicopter!" ) envelope.add_attachment('/Users/bilbo/Pictures/helicopter.jpg') envelope.send('smtp.googlemail.com', firstname.lastname@example.org', password='password', tls=True)
All the dirty work is done for you :).
Install it with the usual:
$ pip install Envelopes
Discuss this post on Reddit.