473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

I am having a problem sending email through smtp.gmail.com 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('smtp.gmail.com',25)
(250, 'mx.google.com at your service, []\nSIZE 28311552\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES' )
(220, '2.0.0 Ready to start TLS')
(250, 'mx.google.com 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\smtplib.py", line 716, in quit
File "c:\Python25\lib\smtplib.py", line 378, in docmd
return self.getreply()
File "c:\Python25\lib\smtplib.py", line 352, in getreply
line = self.file.readline()
File "c:\Python25\lib\smtplib.py", line 160, in readline
chr = self.sslobj.read(1)
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
0 1841

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: nephish | last post by:
Hey there, i am using the smtplib module in python 2.3 my question is, this works: server = smtplib.SMTP(localhost) then server.sendmail(to address, from address, message)
by: downwitch | last post by:
Greetings, I have an application which has recently gone from being one big piece of front-end code to being three, i.e. an mdb A that references an mda B and an mda C. (For what it's worth, in...
by: Max | last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user: Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMail...
by: 3KWA | last post by:
Hi all, I tried to send a small mailing list using python today (2036 emails). For that purpose I looked in the doc for some code examples (I had never done it before). And I ended up writing...
by: NicolasG | last post by:
I'm using the following code to send e-mail through python: import smtplib fromaddr = 'myMail@gmail.com' toaddrs = 'myOtherMail@gmail.com' subject = 'someting for subject !' msg = 'This...
by: carlistixx | last post by:
Hi, I'm using the roundup issue tracker (http://roundup.sourceforge.net) which uses smtplib to send mail. It all worked until we moved to a hosted Exchange MTA. The hosting provider requires the...
by: cher | last post by:
Hey, Don't know if you can help, but I'm trying to import archived messages from Thunderbird into my gmail account and keep getting these types of errors. I am using the GML program to help...
by: 7stud | last post by:
On May 17, 12:18pm, cher <cheryl.gi...@comcast.netwrote: Can you get the following program to work? #Uses gmail to send an email to someone import smtplib sender = "Tom"
by: zxo102 | last post by:
Hi, I am trying to use python module smtplib to send my email out on window xp (localhost). import smtplib server = smtplib.SMTP('localhost') but I got the error information as follows: ...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.