Skip to content

Instantly share code, notes, and snippets.

@RichLogan
Created May 8, 2014 18:30
Show Gist options
  • Save RichLogan/1b43f20d9001dfc16734 to your computer and use it in GitHub Desktop.
Save RichLogan/1b43f20d9001dfc16734 to your computer and use it in GitHub Desktop.
Python SMTP Snippet
sender = '"NAME" <name@domain.com>'
recipient = '"NAME" <name@domain.com>'
subject = "Subject"
message = ""
server = smtplib.SMTP('smtp.server.com')
m = "From: %s\r\nTo: %s\r\nSubject: %s\r\nX-Mailer: YOUR_APPLICATION_URL\r\n\r\n" % (sender, recipient, subject)
server.sendmail(sender, recipient, m+message)
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment