mailer python module


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

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


Send an email with an attachment.

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

Use default arguments, multiple recipients

message = mailer.Message(From="", To=["", ""], Subject="My Vacation", attachments=["picture.jpg"]) message.Body = open("letter.txt", "rb").read() sender = mailer.Mailer('') 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.