I'm sorry I didn't point out exeptions caused in smtplib, and too late to reply.
(I already read <CAJT2EHpZQ7ws6wPFvAUA8rGaExTHGSV=zDzbgt9=AOATES00=q...@mail.gmail.com> on Wed, 23 Oct 2019 11:48:28 -0400 from Nathan and <20191024023717.zzg7tfxtdot4ipgl@tarpaulin.shahaf.local2> on Thu, 24 Oct 2019 02:37:17 +0000 from Daniel, but my this reply is not related to them immediately, so I reply to <CAJT2EHrvhVT+QWxCo+X=6goud0qw+qdzuubtwltyazfg79c...@mail.gmail.com> on Sun, 20 Oct 2019 00:46:25 -0400 from Nathan again.) On 2019/10/20 13:46, Nathan Hartman wrote:
From the "Closing Old Issues" department: SVN-1804: "mailer.py doesn't catch SMTPRecipientsRefused in finish()" * Created and last updated in 2004. * No comments in more than 15 years. From my reading of this issue, the impact is that any mail delivery hiccup may cause this hook script to exit with an unhandled exception, impeding any further mails that it might have sent. Looking at mailer.py in trunk@HEAD, SMTPOutput.finish() doesn't handle any exceptions. In particular: SMTP.login may raise: * SMTPHeloError * SMTPAuthenticationError * SMTPNotSupportedError * SMTPException SMTP.sendmail may raise: * SMTPRecipientsRefused * SMTPHeloError * SMTPSenderRefused * SMTPDataError * SMTPNotSupportedError Any of these exceptions cause the same impact. The same is probably true of any unhandled exceptions throughout the script, but SMTP errors are completely outside our control.
Exception on SMTP.login will be repeated unless its response code indicates temporary error (3XX), because each try uses same parameters. On the other side, on SMTP.sendmail, with other sender, recipient, or even message data, try after failure may succeed, of course it depend on kind of exception. So I think those are not the same impact. Some of them are fatal and others are not. I guess that is why the reporter mensions only SMTPRecipientRefused in those exceptions. As how far we analyze and handle errors honestly is a trade-off between simplicity and precision, I don't want and don't aim to analyze too deep. Cheers, -- Yasuhito FUTATSUKI <futat...@poem.co.jp>