【发布时间】:2018-09-14 18:11:46
【问题描述】:
我正在使用 Laravel 发送邮件,如下所示:
foreach ($users as $user) {
\Mail::to($user())->send(new Newsletter($user));
}
我想要一个包含所有有 bad_domain 响应的用户的数组。我在docs 中发现 Laravel 使用 Swiftmailer,它有a way to find bad_domain respones:
// Pass a variable name to the send() method
if (!$mailer->send($message, $failures))
{
echo "Failures:";
print_r($failures);
}
/*
Failures:
Array (
0 => receiver@bad-domain.org,
1 => other-receiver@bad-domain.org
)
*/
但是,我想使用 Mailable 类。我不确定如何使用 Swiftmailer(我可以通过 \Mail::getSwiftMailer() 访问)来做到这一点。
在使用 Laravel 的 Mailable 时,有什么简单的方法可以获取 bad_domains 吗?
【问题讨论】:
标签: php laravel swiftmailer