Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def send_email(to, subject, body):
  2. gmail_user = 'pragmaniaapp@gmail.com'
  3. gmail_password = 'qqdqPrag321qqdq'
  4.  
  5. sent_from = gmail_user
  6. message = 'Subject: {}\n\n{}'.format(subject, body)
  7.  
  8. try:
  9. server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  10. server.ehlo()
  11. server.login(gmail_user, gmail_password)
  12. server.sendmail(sent_from, to, message)
  13. server.close()
  14.  
  15. print('Email sent!')
  16. except:
  17. print('Something went wrong...')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement