By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,217 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,217 IT Pros & Developers. It's quick & easy.

smtplib starttls gmail example

P: n/a
py
from smtplib import SMTP
from socket import sslerror #if desired
server = SMTP('smtp.gmail.com')
server.set_debuglevel(0) # or 1 for verbosity
server.ehlo('y**********@gmail.com')
server.starttls()
server.ehlo('y**********@gmail.com') # say hello again
server.login('y**********@gmail.com', 'yourpassword')
# i have a suspicion that smptlib does not add the required newline dot newline so i do it myself
server.sendmail('y**********@gmail.com', 'r*@cipient.com', message_text + '\n.\n')
# next line generates the ignorable socket.sslerror
server.quit()
Jan 23 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.