Created
July 12, 2012 08:42
-
-
Save tejastank/3096755 to your computer and use it in GitHub Desktop.
Python smtp email smtplib
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
import smtplib | |
to = '[email protected]' | |
gmail_user = '[email protected]' | |
gmail_pwd = '22222' | |
smtpserver = smtplib.SMTP("smtp.gmail.com",587) | |
smtpserver.ehlo() | |
smtpserver.starttls() | |
smtpserver.ehlo | |
smtpserver.login(gmail_user, gmail_pwd) | |
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:testing \n' | |
print header | |
msg = header + '\n this is test msg from mkyong.com \n\n' | |
smtpserver.sendmail("[email protected]", to, msg) | |
print 'done!' | |
smtpserver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment