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('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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mailer-0.8.1.zip.
File metadata
- Download URL: mailer-0.8.1.zip
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3411a12197731e0d5379ab194d9acc8d0d71c8b95fdfb11474d67c3e9860070e
|
|
| MD5 |
6f5f0ed09dd7abfe482c8de606a78b5c
|
|
| BLAKE2b-256 |
30e7c3a932fc03ab95c96ff911d8ee3e89b937205596a5c1f00849401a2468e0
|
File details
Details for the file mailer-0.8.1.win32.exe.
File metadata
- Download URL: mailer-0.8.1.win32.exe
- Upload date:
- Size: 202.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a66ab3de3c77e36d4ef744a03d6ee24271546a786580020bb226b7cea65843e
|
|
| MD5 |
382c12e30f079cf0a0d84bb2bd6b26fb
|
|
| BLAKE2b-256 |
8c1264abb34c14d2bbb27e0c08dcaa9afccc8abb2e6c7945377d73291ea44d97
|