SwiftMailer 中如何提取投递失败?
How to extract delivery failure in SwiftMailer?
SwiftMailer 的文档说:
It’s possible to get a list of addresses that were rejected by the Transport by using a by-reference parameter to send(). As Swift Mailer attempts to send the message to each address given to it, if a recipient is rejected it will be added to the array.
// Pass a variable name to the send() method
if (!$mailer->send($message, $failures))
{
echo "Failures:";
print_r($failures);
}
但是,我没有找到确定失败原因的方法。例如。 send
returns 0, $failures
填的是邮箱地址,但是我想知道为什么发送有failed/rejected.
我该怎么做?不可能吗?快速查看源代码表明 SwiftMailer catch
es 异常来填充 $failedRecipients
并且似乎异常的消息没有保存在任何地方。我错过了什么吗?
我认为不可能做到这一点。遗憾的是,只能看到失败的电子邮件地址列表,而看不到这些地址失败的原因。
来自 GitHub (https://github.com/swiftmailer/swiftmailer/issues/891) 的讨论:
Exceptions are swallowed silently in \Swift_Transport_AbstractSmtpTransport::_doMailTransaction()
SwiftMailer 的文档说:
It’s possible to get a list of addresses that were rejected by the Transport by using a by-reference parameter to send(). As Swift Mailer attempts to send the message to each address given to it, if a recipient is rejected it will be added to the array.
// Pass a variable name to the send() method if (!$mailer->send($message, $failures)) { echo "Failures:"; print_r($failures); }
但是,我没有找到确定失败原因的方法。例如。 send
returns 0, $failures
填的是邮箱地址,但是我想知道为什么发送有failed/rejected.
我该怎么做?不可能吗?快速查看源代码表明 SwiftMailer catch
es 异常来填充 $failedRecipients
并且似乎异常的消息没有保存在任何地方。我错过了什么吗?
我认为不可能做到这一点。遗憾的是,只能看到失败的电子邮件地址列表,而看不到这些地址失败的原因。
来自 GitHub (https://github.com/swiftmailer/swiftmailer/issues/891) 的讨论:
Exceptions are swallowed silently in
\Swift_Transport_AbstractSmtpTransport::_doMailTransaction()