Mailer: Sending emails using Python
Sending emails is a common task in developer activity.
For this Python provides many libraries, especially smtplib and email: http://docs.python.org/release/2.4/lib/node578.html
But this is sometime a bit complicated to manage, even more when you use attachement files.
Mailer is a simple Python API allowing to send emails and requiring very few code to produce:
from mailer import Mailer from mailer import Message message = Message(From="firstname.lastname@example.org", To=["email@example.com", "firstname.lastname@example.org"], Subject="Cute Cat") message.Body = """Kittens with dynamite""" message.attach("kitty.jpg") sender = Mailer('smtp.example.com') sender.send(message)
Current version is actually 0.7, but it does not compile with Python 2.4.
As I like working with old python versions, I've created a Python 2.4 fork of the mailer library, that you may find useful.