Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MakStashkevich/1febdfaf40e11f88ce346491196b29bd to your computer and use it in GitHub Desktop.
Save MakStashkevich/1febdfaf40e11f88ce346491196b29bd to your computer and use it in GitHub Desktop.
Python smtp email smtplib
import smtplib
to = '22.22@22.com'
gmail_user = '22222@gmail.com'
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("tejas.tank@microsoft.com", to, msg)
print 'done!'
smtpserver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment