Loading...
Skip to content
Warren Myers' Merikebi My online archive
  • RSS
  • Facebook
  • Instagram
  • Pinterest
  • Twitter
  • LinkedIn
  • GitHub
  • Telegram
  • Skype

Pages

  • Welcome to Warren Myers’ Merikebi
  • Pocket

Tag:smtp

sending email in python with gmail

Posted on 15 May 2014by merikebiCategories:code, quote, reprint, technical

A {{Python}} nugget from {{Programming Your Home}} (review) I wanted to share from p97: import smtplib def send_email(subject, message) recipient = ‘your_email_recipient@domain.tld’ gmail_sender = ‘your_gmail_account@gmail.com’ gmail_password = ‘your_gmail_password’ #use tls gmail_smtp = smtplib.SMTP(‘smtp.gmail.com’, 587) gmail_smtp.ehlo() gmail_smtp.starttls() gmail_smtp.ehlo() #login gmail_smtp.login(gmail_send, gmail_password) #message formatting mail_header = ‘To: ‘ + recipient + ‘\n’ + ‘From: ‘ + gmail_sender …
Continue reading sending email in python with gmail

Taggedpythonsmtp
  • RSS
  • Skype
© Warren Myers' Merikebi. All rights reserved.
Back to top