Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- import email.utils
- from email.mime.text import MIMEText
- smtpserver = smtplib.SMTP("smtp.gmail.com",587)
- smtpserver.ehlo()
- smtpserver.starttls()
- smtpserver.ehlo()
- smtpserver.login('username@gmail.com', 'pwd')
- msg['Subject'] = "subject line"
- msg['From'] = 'newusername@gmail.com'
- msg['To'] = 'friend@gmail.com'
- smtpserver.sendmail(sender, recipients, msg.as_string())
Add Comment
Please, Sign In to add comment