-
-
Save oba11/3446f6f519b7e09c9d4e45728f73799e to your computer and use it in GitHub Desktop.
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 | |
sender = 'printer-no-reply@gmail.com' | |
receiver = '' | |
smtp_address = '127.0.0.1' | |
message = """From: From Person <%s> | |
To: To Person <%s> | |
Subject: SMTP e-mail test | |
This is a test e-mail message. | |
""" % (sender, receiver) | |
try: | |
smtpObj = smtplib.SMTP(smtp_address) | |
smtpObj.sendmail(sender, receiver, message) | |
print "Successfully sent email" | |
except smtplib.SMTPException: | |
print "Error: unable to send email" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment