New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
smtplib SMTP_SSL not working. #48720
Comments
The enclosed patch does three things:
|
I've reworked the patch into a series, like haypo requested for |
With the closure of 4066 all the tests in the test patch pass, so I'm I haven't reviewed the other patches, but the tests in the test patch |
I still have to apply Catucci's patch (or a modification of) after every Ubuntu installation or upgrade. Otherwise, I get ... But isn't it that bpo-4066 should have solved the critical part this issue pair 4066/4470? |
Torsten, can you provide a clear, failing unittest for this? |
No, I don't know how to do that. All I can provide is a minimal version of my code that triggers the above mentioned traceback. It is: import smtplib
s = smtplib.SMTP_SSL("relay-auth.rwth-aachen.de")
s.login("***", "***")
s.sendmail("bronger@physik.rwth-aachen.de", "bronger.randys@googlemail.com"], "Hello") I hope it helps to understand what I mean. |
Sorry, it must be: import smtplib
s = smtplib.SMTP_SSL("relay-auth.rwth-aachen.de")
s.login("***", "***")
s.sendmail("bronger@physik.rwth-aachen.de", ["bronger.randys@googlemail.com"], "Hello") (A bracket was missing.) |
According to your traceback you should be seeing the error in the first line (the creation of the SMTP_SSL object). If I run that line at the python prompt of python2.7.1, I get your connection failure. If I run it using 2.7 tip (or 3.3 tip), the connection succeeds. I know there have been other fixes in this area, but I don't know which one makes the difference. Torsten, can you test with 2.7.2 and/or 2.7 tip? I'm not sure what is left to do in this issue. Do you have an opinion, Lorenzo? |
On Fri, 17 Jun 2011, R. David Murray wrote: RDM> Torsten, would you mind letting us know both the python and the .deb $ python2.7 --version and $ dpkg -l python2.7 At least in debian's python2.7_2.7.1-8, default_port is still an instance If the ubuntu situation is the same, the missing patch is The patch got in with: changeset: 69931:bcf04ced5ef1 The last hunk, which fixes LMTP is still missing. @@ -776,8 +777,9 @@ ehlo_msg = "lhlo"
+ default_port = LMTP_PORT - def __init__(self, host = '', port = LMTP_PORT, local_hostname =
None):
+ def __init__(self, host = '', port = 0, local_hostname = None):
"""Initialize a new instance."""
SMTP.__init__(self, host, port, local_hostname) Have a nice week-end, yours
+-------------------------+----------------------------------------------+ |
Most of the problems in this issue were solved already so it could almost be closed:
Torsten's problem was addressed by bcf04ced5ef1.
The only patch remaining is patch 5. I attached an updated version against tip of default branch. My patch mimics shutdown in imaplib.py in that it silences ENOTCONN. However I don't have a test that fails without the shutdown and I don't know if checking ENOTCONN is really needed. I tried to get shutdown to produce ENOTCONN by using Postfix as a server with smtpd_timeout=5s, connecting to it and waiting idle for more than 5 seconds before doing close(). In the Postfix logs I see that Postfix disconnects after 5 seconds of inactivity but doing shutdown afterwards doesn't trigger any exception so the ENOTCONN part remains unexercised. My patch also adds shutdown method and SHUT_RDWR constant to mock_socket.py since otherwise test_smtplib fails. (Added Antoine to nosy because he reviewed the patches for bpo-11927 and bpo-11893) |
My Python version is "Python 2.7.1+" and the package is called "python2.7 2.7.1-5ubuntu2" (Ubuntu Natty). |
Just finished testing both 2.7 and default branches' socket close behaviour, and it seems 05 is not strictly needed. I'd still prefer if smtplib_05_shutdown_socket_v2.patch since, this way the REMOTE socket close will be unconditionally correct, instead of being dependent on GC artifacts. |
I'd still prefer if smtplib_05_shutdown_socket_v2.patch could get in, |
For five Ubuntu releases now, I apply this patch. In contrast to Catalin's statement, it is not solved for me unless the upstream changes of two years ago haven't yet found their way into Ubuntu. I'm currently using Python 2.7.4 on Ubuntu 13.04. That said, the patch solves my issue every time. |
When you say "I apply this patch", you mean smtplib_05_shutdown_socket_v2.patch, right? |
In any case, I'm growing wary of bugfix regressions right now, so I would only apply the patch on the default branch. |
Sorry, after having had another look at it, I realised that I have a different SSMTP issue now, non-Python-related. So for me, Ubuntu 13.04 indeed solves my old issue. |
Lorenzo, any chance you could supply a unit test that fails without smtplib_05_shutdown_socket.diff applied? |
On Sun, 19 May 2013, R. David Murray wrote: RDM> It would really be a functional test, since the problem with half-open To test we should setup a fake smtp server, which forbids having multiple Thank you very much,
|
The bug is 8 years old and hasn't seen activity for three years. Is SMTP over SSL still broken for you? |
This issue has been in pending status for over 18 months following Christian's question to the OP, so closing as out of date. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: