#!/bin/env python
import smtplib
SERVER = "localhost"
FROM = "buggers@myorg.net" TO = ["user@example.com"] # must be a list
SUBJECT = "Hello!"
TEXT = "This message was sent with Python's smtplib."
message = """
From: %s
To: %s
Subject: %s
%s """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
server = smtplib.SMTP(SERVER) server.sendmail(FROM, TO, message) server.quit()