Skip to main content

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.

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

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, 2.5, and 2.6

Release files for mailer 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailer 0.8.1
File Size Uploaded
mailer-0.8.1.zip 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mailer 0.8.1
File Interpreter ABI Platform
mailer-0.8.1.win32.exe Details

Total release size: 208.6 kB

Release files / mailer-0.8.1.zip

Download URL mailer-0.8.1.zip
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3411a12197731e0d5379ab194d9acc8d0d71c8b95fdfb11474d67c3e9860070e
BLAKE2b-256 checksum
How to use checksums
30e7c3a932fc03ab95c96ff911d8ee3e89b937205596a5c1f00849401a2468e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mailer-0.8.1.win32.exe

Download URL mailer-0.8.1.win32.exe
Size 202.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0a66ab3de3c77e36d4ef744a03d6ee24271546a786580020bb226b7cea65843e
BLAKE2b-256 checksum
How to use checksums
8c1264abb34c14d2bbb27e0c08dcaa9afccc8abb2e6c7945377d73291ea44d97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.8

2 release files

0.7

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page