Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- smtpUser = 'myemail@gmail.com'
- smtpPass = 'mypassword'
- toAdd = 'target@gmail.com'
- fromAdd = smtpUser
- subject = 'Python Test'
- header = 'To: ' + toAdd + 'n' + 'From: ' + fromAdd + 'n' + 'Subject: ' + subject
- body = 'From within a Python script'
- msg = header + 'n' + body
- print header + 'n' + body
- s = smtplib.SMTP('smtp.gmail.com',587)
- s.ehlo()
- s.starttls()
- s.ehlo()
- s.login(smtpUser,smtpPass)
- s.sendmail(fromAdd, toAdd, msg)
- s.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement