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

smtplib, gmail, quit vs. close and SSL3_GET_RECORD:wrong versionnumber

P: n/a
I am having a problem sending email through using
smtplib. Everything works and the mail is sent and received, except
quit. The following shows the problem (without bothering to login or do
the sendmail):
>>>import smtplib
server = smtplib.SMTP('',25)
(250, ' at your service, []\nSIZE 28311552\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES' )
(220, '2.0.0 Ready to start TLS')
(250, ' at your service, []\nSIZE 28311552\n8BITMIME\nAUTH LOGIN PLAIN\nENHANCEDSTATUSCODES')
(250, '2.0.0 OK')

Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
File "c:\Python25\lib\", line 716, in quit
File "c:\Python25\lib\", line 378, in docmd
return self.getreply()
File "c:\Python25\lib\", line 352, in getreply
line = self.file.readline()
File "c:\Python25\lib\", line 160, in readline
chr =
sslerror: (1, 'error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number')
I have not had this problem with other mail servers (but only tried
two). A solution for gmail seems to be to replace the server.quit()
with server.close(). The difference between the two commands is quit()
sends a 'QUIT' string before calling close(). Because close() is not
included in the smtplib docs, it does not appear to be the right solution.

What is the correct way to terminate a gmail session?

Aug 5 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.