1、Laravel7 Failed to authenticate on SMTP server with username

1>.检查env文件是否正确配置

MAIL_USERNAME为qq邮箱
MAIL_PASSWORD 为授权码  设置->账户->POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务 POP3/SMTP服务 (如何使用 Foxmail 等软件收发邮件?) 开启

MAIL_PORT=465对应MAIL_ENCRYPTION=ssl

2>.清除配置缓存

php artisan config:cache

3>.  重启服务器

2、Expected response code 250 but got code “501“, with message “501 mail from address

 config/mail.php

 配置应和env文件配置一致,不一致也会报如上错误

 

配置如下:

 

MAIL_DRIVER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=465
MAIL_USERNAME=XXX@qq.com
MAIL_PASSWORD=XXXXXXXXXXXXXXXX
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=XXX@qq.com
MAIL_FROM_NAME=XXX@qq.com

 

posted on 2021-01-06 13:34  程序小院  阅读(503)  评论(0编辑  收藏  举报