如何使用symfony查看swiftmailer中的发送状态?
我这样发送邮件:$res = $this->get('mailer')->send($message) Now $res总是处于1状态,即使我在参数中设置了错误的密码。电子邮件未发送,状态为1 :/
如果发送时有任何问题,我想抛出一些信息:/
发布于 2017-07-19 05:21:18
您可以在send()中使用第二个参数
$res = $this->get('mailer')->send($message, $errors)发布于 2019-02-11 22:00:36
try {
$this->get('mailer')->send($message);
}
catch (\Exception $exception) {
$errors = $exception->getMessage();
}如果发送失败,$errors变量将包含消息。
https://stackoverflow.com/questions/45176452
复制相似问题