Swift_TransportException Expected response code 250 but got code "553", with message "553 Mail from must equal authorized user
上面是我的错误提示,配置信息如下:
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'viewPath'=>'@app/mailer',
'useFileTransport' => false,
'transport'=>[
'class'=>'Swift_SmtpTransport',
'host'=>'smtp.163.com',
'username'=>'[email protected]',
'password'=>'***********',
'port'=>'25',
'encryption'=>'tls',
],
'messageConfig'=>[
'charset'=>'UTF-8',
'from'=>['[email protected]'=>'admin']
],
],
但是注册的时候发送出现错误。
如果载控制器中直接调用发送邮件,是可以成功的。下面就是测试控制器发送的代码
$mail= Yii::$app->mailer->compose();
$mail->setTo('[email protected]');
$mail->setSubject("邮件测试");
//$mail->setTextBody('zheshisha '); //发布纯文字文本
$mail->setHtmlBody("<br>问我我我我我"); //发布可以带html标签的文本
if($mail->send())
echo "success";
else
echo "failse";