主要记录laravel5.8 发送邮件报错Expected response code 250 but got code “501”, with message “501 Mail from address must be same as authorization user
我们看下.env email配置
1 2 3 4 5 6
| MAIL_DRIVER=smtp MAIL_HOST=smtp.qq.com MAIL_PORT=25 MAIL_USERNAME=xxxx@qq.com MAIL_PASSWORD=xxxxxbrgodjig MAIL_ENCRYPTION=null
|
去看下邮件配置文件mail.php:
1 2 3 4
| 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' => env('MAIL_FROM_NAME', 'Example'), ],
|
在.env中没有MAIL_FROM_ADDRESS,MAIL_FROM_NAME配置项,把这2个配置项添加到.env。
配置如下:
1 2 3 4 5 6 7 8
| MAIL_DRIVER=smtp MAIL_HOST=smtp.qq.com MAIL_PORT=25 MAIL_USERNAME=xxxx@qq.com MAIL_PASSWORD=nhcxxxxqtvbeaf MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=xxxx@qq.com MAIL_FROM_NAME=致梦
|
邮件发送成功,问题解决!
nice!!
注意:授权密码一定要正确!!开启25端口