mailer python module

mailer

mailer is a python module that lets you send email simply. It wraps the smtp and email modules, and takes care of a lot of the drudgework of creating and sending email.

Version History

0.5
Added ability to send HTML emails with attachments
0.4
Added ability to specify port in Mailer.__init__
0.3
Changed API for Message.To to accept string for single recipient, and iterable for multiple recipients
0.2
Initial release

Usage

Send an email with an attachment.

import mailer message = mailer.Message() message.From = "me@example.com" message.To = "you@example.com" message.Subject = "My Vacation" message.Body = open("letter.txt", "rb").read() message.attach("picture.jpg") sender = mailer.Mailer('mail.example.com') sender.send(message)

Use default arguments, multiple recipients

message = mailer.Message(From="me@example.com", To=["spam@example.com", "eggs@example.com"], Subject="My Vacation", attachments=["picture.jpg"]) message.Body = open("letter.txt", "rb").read() sender = mailer.Mailer('mail.example.com') sender.send(message)

Quick Links

Here is the original blog post describing the module, and here is the post describing the release of version 0.2.