Archive for the ‘python’ Tag

Python GMail SMTP Example « Code Comments

A good simple example on how to connect to GMail’s SMTP service. Works also for Google Apps. The main difference with other SMTP servers is the ehlo/starttls/ehlo sequence after initializing the SMTP object.


mailServer = smtplib.SMTP('smtp.gmail.com', 587)

mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()

mailServer.login(gmailUser, gmailPassword)

Follow

Get every new post delivered to your Inbox.