如何检查在swiftmailer发送状态用symfony?
我发邮件是这样的:$res = $this->get('mailer')->send($message)
现在$res
始终即使我设置参数错误密码状态1
。电子邮件没有发送和状态1
:/
我想抛出一些类型的信息是否存在与发送任何问题:/
您可以使用send()
第二个参数
$res = $this->get('mailer')->send($message, $errors)
try {
$this->get('mailer')->send($message);
}
catch (\Exception $exception) {
$errors = $exception->getMessage();
}
如果发送失败的$errors
变量将包含该消息。