SMTP server did not accept MAIL FROM

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Cpath/article/details/78996851

https://packagist.org/packages/nette/mail

<br />
<b>Fatal error</b>:  Uncaught Nette\Mail\SmtpException: SMTP server did not accept MAIL FROM:&lt;xxxxx@163.com&gt; with error: 553 Mail from must equal authorized user in /home/www/sslapi/api/vendor/nette/mail/src/Mail/SmtpMailer.php:190
Stack trace:
#0 /home/www/sslapi/api/vendor/nette/mail/src/Mail/SmtpMailer.php(86): Nette\Mail\SmtpMailer-&gt;write('MAIL FROM:&lt;1369...', 250)
#1 /home/www/sslapi/api/application/library/Service/Test/mailMgr.php(63): Nette\Mail\SmtpMailer-&gt;send(Object(Nette\Mail\Message))
#2 /home/www/sslapi/api/application/controllers/Test.php(25): Service\Test\mailMgr-&gt;sendMail()
#3 [internal function]: TestController-&gt;sendMailAction()
#4 /home/www/sslapi/api/index.php(7): Yaf_Application-&gt;run()
#5 {main}
  thrown in
<b>/home/www/sslapi/api/vendor/nette/mail/src/Mail/SmtpMailer.php</b> on line
<b>190</b>
<br />

        $mail->setFrom('cpath <[email protected]>')//setFrom中的邮件地址确保和 username一致
            ->addTo('[email protected]')
            ->setSubject('test mail')
            ->setBody("test mail set body");

        $mailer = new SmtpMailer([
            'host' => 'smtp.163.com',
            'username' => '[email protected]',
            'password' => 'cpath121212', /* smtp独立密码 *******/
            //'password' => 'xxxx', /* smtp独立密码 */
            'secure' => 'ssl',
        ]);

        $res  = $mailer->send($mail);
        var_dump($res);die;

猜你喜欢

转载自blog.csdn.net/Cpath/article/details/78996851
今日推荐