Open flancer64 opened 5 years ago
This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/15.
This repository has been moved to laminas/laminas-mail. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:
git rebase -i origin/{branch}
)
Hi, guys.
I just found that
mail()
function does not generate the proper error that can be handled byhandleMailErrors()
method ("Temporary error handler for PHP native mail()" as pointed in the phpdoc). I have an msmtp as email agent with following settings inphp.ini
:I have an error in
\Zend\Mail\Transport\Sendmail::mailHandler
ifin
As I see, there is a conflict between
--read-envelope-from
option ofmsmtp
and-f'sender@email.com'
parameter ofmail
function. So,mail
function returnsfalse
in this case.But this code does not handle the error as expected. The breakpoint in
handleMailErrors
method does not activated when error occurs (I have PHP 7.2.19 & PHPStorm 2019.1.3).I found that
error_get_last()
function may help in this case.In addition I think we should not throw an exception if
$result
istrue
.So, I suppose, the final code for
mailHandler
should be the following:Sorry, my qualification is not enough to complete all items you want to see here (regression test, CHANGELOG.md, etc.). But I hope my point of view may be useful.
Have a good day!