Created
August 7, 2014 14:02
-
-
Save guysoft/a14cc88b9b9afd5fc452 to your computer and use it in GitHub Desktop.
send email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import smtplib | |
import sys | |
import string | |
fromaddr = '<your gmail address>' | |
toaddrs = '<destination address>' | |
msg = sys.argv[1] | |
subject = "3D printer message" | |
body = string.join(( | |
"From: %s" % fromaddr, | |
"To: %s" % toaddrs, | |
"Subject: %s" % subject, | |
"", | |
msg), "\r\n") | |
# Credentials (if needed) | |
username = '<username>' | |
password = '<password>' | |
# The actual mail send | |
server = smtplib.SMTP('smtp.gmail.com:587') | |
server.starttls() | |
server.login(username,password) | |
server.sendmail(fromaddr, toaddrs, body) | |
server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment