This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients barry, jcea, kushal.das, msapiro, r.david.murray, terry.reedy
Date 2013-03-20.19:51:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363809116.38.0.558393495953.issue5713@psf.upfronthosting.co.za>
In-reply-to
Content
I think this should be considered a bug fix.  While it is true that we are handling something that is a "more advanced" feature of the smpt protocl than what we are (currently) formally supporting in the module, the reality is that if one uses smtplib to communicate with a foreign mail server, you currently get unhandleable errors even if the library sticks to the currently supported RFC level.  I think that the fact that smtplib does the wrong then when it receives an unexpected error code followed by a connection close is a bug in smtplib regardless of what RFC level we are talking about.

In fact, this is one instance of a larger problem.  I have also seen a server that returns a 451 error code at the end of a data command *and then disconnects*.  I think that is out of spec even with the newer RFCs, but it is something that happens in the real world and so we should handle it.

The general problem in smtplib is that it does an rset on error, and if the other end has closed the connection, the rset raises a ServerDisconnectedError, masking the error code that the server actually reported.  This also should be fixed.

Clearly for 421 we should be doing a close and not an rset, and I think we may as well go ahead and do that even if we haven't upgraded the library to fully comply with the newer RFC yet, especially since we've got a patch here.  It is not a publicly visible API change, so I don't think the "new feature" rule needs to be applied strictly.  Correctly handling the case of rset finding the socket already closed would also have fixed this bug, and we should make that fix as well, since it seems that servers may unexpectedly close the connection after any error.
History
Date User Action Args
2013-03-20 19:51:56r.david.murraysetrecipients: + r.david.murray, barry, terry.reedy, jcea, msapiro, kushal.das
2013-03-20 19:51:56r.david.murraysetmessageid: <1363809116.38.0.558393495953.issue5713@psf.upfronthosting.co.za>
2013-03-20 19:51:56r.david.murraylinkissue5713 messages
2013-03-20 19:51:55r.david.murraycreate