Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A module to send email simply in Python

Project Description

Here are some of the features:

  • Single class to send plain text, HTML email, and attachments
  • Auto detects attachment types
  • Support for internationalized headers

Changes in version 0.3

The API for Mailer.To is changed. Use a string to specify a single recipient, and an iterable to specify more than one.

Changes in version 0.4

You can now specify the port in Mailer

from mailer import Mailer
sender = Mailer('', port=20)

Changes in version 0.5

  • Message.attach takes an optional cid argument.
  • You can now send HTML emails with attachments

Thanks to Douglas Mayle for his patch for this.

Changes in version 0.6

  • Can now select port
  • Supports gmail

Changes in version 0.7

  • You can now specify MIME type:

    msg.attach("picture.png", mimetype="image/png")

Changes in version 0.8

  • Various bug fixes


Sending an HTML email:

from mailer import Mailer
from mailer import Message

message = Message(From="",
message.Subject = "An HTML Email"
message.Html = """This email uses <strong>HTML</strong>!"""
message.Body = """This is alternate text."""

sender = Mailer('')

Sending an attachment:

from mailer import Mailer
from mailer import Message

message = Message(From="",
                  To=["", ""],
                  Subject="Cute Cat")
message.Body = """Kittens with dynamite"""

sender = Mailer('')

Tested with Python 2.4, 2.5, and 2.6

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(202.0 kB) Copy SHA256 Hash SHA256
any Windows Installer Apr 22, 2015
(6.5 kB) Copy SHA256 Hash SHA256
Source Apr 22, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting