Skip to content

Instantly share code, notes, and snippets.

@hugo-dc
Created May 16, 2013 22:52
Show Gist options
  • Save hugo-dc/5595728 to your computer and use it in GitHub Desktop.
Save hugo-dc/5595728 to your computer and use it in GitHub Desktop.
Send SMTP email
import smtplib
SERVER = 'server.com'
FROM = '[email protected]'
TO = ['test.server.com']
SUBJECT = 'New Subject'
TEXT = 'This is the text'
message = """From: %s\r\nTo: %s\r\nSubject: %s\r\n\
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment