开发者

Swift Mailer does not return smtp mail failure

I am using Swiftmailer to send emails with SMTP

I need to get response from SMTP, but what I am trying is not working. Is it even possible?

I tried an invalid email: dima44324d@vdaszdsd1dw.com - on the code below, which does not return errors

    if (!$mailer->send($message, $fails))
    {
          echo "Failures:";
          print_r($fails);
          return false;
    }

    开发者_运维知识库return true;

P.S. I don't want to use PhpMailer because I have other issues with it.


Remember that Swiftmailer simply hands the email over to an SMTP server. It does not actually deliver it. It's not Swiftmailer's job to determine if the email address you're telling it to send to is valid or not. As long as the address conforms to RFC822 standards, it'll be accepted by Swiftmailer, and be accepted by whatever SMTP server you're using.

It's only when that SMTP server attempts to actually DELIVER the email to the invalid hostname that you'll get a failure. By that point, Swiftmailer's already disconnected and reported success - it has accomplished its mission. The failure has occured farther down the line, outside of Swiftmailer's view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜