Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required " - 小众知识

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required "

2020-08-18 16:35:39 苏内容
  标签: laravel/mail
阅读:6688

如题,在使用laravel时,mail按照配置

MAIL_DRIVER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=465
MAIL_USERNAME=********@qq.com
MAIL_PASSWORD=**********
MAIL_ENCRYPTION=SSL


出现问题Expected response code 250 but got code "", with message ""

推测是验证成功了,但是不知道为什么不能正常发送email

在google上查询了一番后,觉得有可能是qq邮箱的设置问题

检查后发现确实如此,是qq邮箱内未开启IMAP/SMTP

开启后邮箱会给一个设置码,用它替换掉MAIL_PASSWORD即可成功发送。



Expected response code 250 but got code "553", with message "553 Mail from must equal authorized user "


天在做项目的时候,使用laravel做消息通知,安装官网教程一步一步做下来,测试的时候报错,

Expected response code 250 but got code "553", with message "553 Mail from must equal authorized use

转载请注明(B5教程网)原文链接:http://www.bcty365.com/content-153-5898-1.html

当时.env邮箱配置如下:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.163.com
MAIL_PORT=25
MAIL_USERNAME=xxxx@163.com
MAIL_PASSWORD=1xxxxx71987
MAIL_ENCRYPTION=null
但是我们注意一下config/mail.PHP中有两项

‘from‘ => [
‘address‘ => env(‘MAIL_FROM_ADDRESS‘, ‘hello@example.com‘),
‘name‘ => env(‘MAIL_FROM_NAME‘, ‘Example‘),
],
这里的MAIL_FROM_ADDRESS,MAIL_FROM_NAME在配置文件中是没有的。所以我们应该加到.env中

最后配置如下:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.163.com
MAIL_PORT=25
MAIL_USERNAME=xxxx@163.com
MAIL_PASSWORD=1xxxxx71987
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=xxxx@163.com
MAIL_FROM_NAME=132

这样问题解决了,发送邮件成功!



扩展阅读
相关阅读
© CopyRight 2010-2021, PREDREAM.ORG, Inc.All Rights Reserved. 京ICP备13045924号-1