【发布时间】:2021-08-06 12:20:21
【问题描述】:
我有一个功能,可以在每次新注册时向客户发送电子邮件。并且我的客户想要记录发送的任何不成功的电子邮件(即如果电子邮件地址错误)。
我尝试使用 try-cacth 和 mail::failure。
try{
Mail::send('mail.mail', compact(''), function ($message) use ($) {
$message->from();
$message->subject();
$message->to();
});
}
catch(\Swift_TransportException $e){
}
邮件:失败
if (Mail::failures()) {
echo ('error');
}
但如果网络故障,例如电子邮件主机已关闭,则此功能有效。如果由于找不到电子邮件地址/域而未发送电子邮件,如何记录/获取信息。
如果电子邮件未送达,我会在电子邮件中收到此信息。但是如何将ddetails记录到数据库中。
Address not found
Your message wasn't delivered to asna@asmas.cl because the domain asmas.cl couldn't be found. Check for typos or unnecessary spaces and try again.
【问题讨论】:
-
stackoverflow.com/questions/5402051/…,我想另一个(更简单)的选择是让用户验证电子邮件地址?