主要記錄laravel5.8 傳送郵件報錯Expected response code 250 but got code “501”, with message “501 Mail from address must be same as authorization user
我們看下.env email配置
MAIL_DRIVER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=25
MAIL_USERNAME=xxxx@qq.com
MAIL_PASSWORD=xxxxxbrgodjig
MAIL_ENCRYPTION=null
去看下郵件配置檔案mail.php:
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
在.env中沒有MAIL_FROM_ADDRESS,MAIL_FROM_NAME配置項,把這2個配置項新增到.env。
配置如下:
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埠
本作品採用《CC 協議》,轉載必須註明作者和本文連結