smtplib and TLS

Matthias Kluwe mkluwe at gmail.com
Fri Jun 17 15:00:30 EDT 2005


Hi!

After getting a @gmail.com address, I recognized I had to use TLS in my
python scripts using smtplib in order to get mail to the smtp.gmail.com
server.

Things work well so far, apart from an unexpected error. Here's my
sample code:

import smtplib

server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login('mkluwe at gmail.com', password)
server.sendmail("mkluwe at gmail.com", toaddress, message)
server.quit()

The server accepts and delivers my messages, but the last command
raises

socket.sslerror: (8, 'EOF occurred in violation of protocol')

Did I miss something? Any hint is welcome.

Regards,
Matthias




More information about the Python-list mailing list