Mark Sapiro <m...@msapiro.net> added the comment: I'm not completely sure about this, but here's my thoughts. In the scenarios I've seen, the 421 reply/disconnect only occurs in response to a RCPT which has an invalid address and follows several prior refused RCPTs. In this case, I think the proper action is to close the connection and raise SMTPRecipientsRefused and return a dictionary with the actual responses for the refused RCPTS prior to the 421 and the 421 response only for the RCPT that produced it.
If the 421 comes at another time, I think the current process does the right thing. It will raise the appropriate exception if it gets the chance. It just needs to be sure that if the response was 421 that instead of doing self.rset() it does self.close(). I have attached a patch against the 2.6.1 smtplib.py which I think does the right thing. I haven't tested this at all, but I think it should work. The documentation may need to be updated to emphasize that even though all recipients aren't listed in the dictionary returned with the SMTPRecipientsRefused exception, no one got the mail. ---------- keywords: +patch Added file: http://bugs.python.org/file15183/smtplib.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5713> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com