Subject: | Mail/Mailer/smtp error handling |
Date: | Wed, 13 Oct 2010 16:26:42 +0100 |
To: | bug-MailTools [...] rt.cpan.org |
From: | Tristam Fenton-May <tfm-cpanbugs [...] earth.li> |
I think that I have run into a bug/limitation in the error handling in
Mail/Mailer/smtp.pm
The problem is that if the SMTP mailer gives an error, or disconnects
after the DATA command, but before accepting the mail the close function
still returns true indicating that the mail was delivered correctly.
The close function calls epilogue which in turn calls dataend on the
socket, which will return false in the case of these kinds of errors,
but the return value is ignored.
I have attached a patch for smtp.pm which passes the error out of
epilogue and then out of close, it also returns 0 in the case that the
socket is already invalid when it tried to do this, I am not certain
that this is correct, but assume that close() should return an error if
there has been some previous error (e.g. TCP disconnect during the
sending of the data?)
I believe that smtps.pm has the same issue, and a similar fix could be
applied, but I have not tested that.
--
TFM