skip to navigation
skip to content

Not Logged In

mailer 0.5

A module that simplifies sending email.

Latest Version: 0.7

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('smtp.example.com', 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.

Examples

Sending an HTML email:

from mailer import Mailer
from mailer import Message

message = Message(From="me@example.com",
                  To="you@example.com",
                  charset="utf-8")
message.Subject = "An HTML Email"
message.Html = """This email uses <strong>HTML</strong>!"""
message.Body = """This is alternate text."""

sender = Mailer('smtp.example.com')
sender.send(message)

Sending an attachment:

from mailer import Mailer
from mailer import Message

message = Message(From="me@example.com",
                  To=["you@example.com", "him@example.com"],
                  Subject="Cute Cat")
message.Body = """Kittens with dynamite"""
message.attach("kitty.jpg")

sender = Mailer('smtp.example.com')
sender.send(message)

Tested with Python 2.4 and 2.5

 
File Type Py Version Uploaded on Size
mailer-0.5.win32.exe (md5) MS Windows installer any 2009-05-28 63KB
mailer-0.5.zip (md5) Source 2009-05-28 3KB
  • Downloads (All Versions):
  • 41 downloads in the last day
  • 916 downloads in the last week
  • 3596 downloads in the last month