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 msapiro
Recipients msapiro
Date 2009-04-06.20:30:20
SpamBayes Score 9.947603e-05
Marked as misclassified No
Message-id <1239049825.43.0.457403750239.issue5713@psf.upfronthosting.co.za>
In-reply-to
Content
RFC821 upon which smtplib was originally based does not define a 421
status code and implies the server should only disconnect in response to
a QUIT command.

Subsequent extensions in RFC2821 (and now RFC5321) define situations
under which the server may return a 421 status and disconnect. This
leads to the following problem.

An smtplib.SMTP() instance is created and its sendmail() method is
called with a list of recipients which contains several invalid, local
addresses. sendmail() processes the recipient list, calling the rcpt()
method for each. Some of these may be accepted with a 250 or 251 status
and some may be rejected with a 550 or other status. The rejects are
kept in a dictionary to be eventually returned as the sendmail() result.

However, with the Postfix server at least, after 20 rejects, the server
sends a 421 Too many errors reply and disconnects, but sendmail
continues to process and this results in raising
SMTPServerDisconnected("Connection unexpectedly closed") and the
response dictionary containing the invalid addresses and their responses
is lost.

The caller may see the exception as retryable and may retry the send
after some delay, but since the caller has received no information about
the invalid addresses, it sends the same recipient list and the scenario
repeats.
History
Date User Action Args
2009-04-06 20:30:25msapirosetrecipients: + msapiro
2009-04-06 20:30:25msapirosetmessageid: <1239049825.43.0.457403750239.issue5713@psf.upfronthosting.co.za>
2009-04-06 20:30:22msapirolinkissue5713 messages
2009-04-06 20:30:21msapirocreate