Yii2 如何使用swiftmailer将失败的邮件记录到数据库中
如何检查失败的邮件。即使我提供了无效的电子邮件地址,Swiftmailer仍返回true。我需要将发送和失败的邮件记录到数据库中Yii2 如何使用swiftmailer将失败的邮件记录到数据库中,yii2,swiftmailer,Yii2,Swiftmailer,如何检查失败的邮件。即使我提供了无效的电子邮件地址,Swiftmailer仍返回true。我需要将发送和失败的邮件记录到数据库中 $message = Yii::$app->mailer->compose(); $message->attach($protocal.$_SERVER['SERVER_NAME'].$payslip); $message->setTo("tft@sjkdsjk.dfdh"); $message->setFrom("hr@gmail.co
$message = Yii::$app->mailer->compose();
$message->attach($protocal.$_SERVER['SERVER_NAME'].$payslip);
$message->setTo("tft@sjkdsjk.dfdh");
$message->setFrom("hr@gmail.com");
$message->setSubject($vStaffName." ".$vPeriodName. " Payslip");
$message->setTextBody("Find attached copy of your payslip. To open this document use your ID number as password");
$send = $message->send();
变量转储($send);模具()//总是返回true
我认为是真是假您应该向SMTP查询 这意味着您必须连接到该电子邮件的SMTP服务器 连接到SMTP服务器后,应发送以下命令:
HELO somehostname.com
MAIL FROM: <no-reply@gmail.com>
RCPT TO: <emailtovalidate@domain.com>
HELO somehostname.com
邮寄地址:
RCPT至:
如果您收到“中继访问被拒绝”,则表示此电子邮件无效
有一个简单的PHP类。您可以使用它: