0
我已經在config/mail.php中設置了從地址。但在郵件中,地址是smtp用戶名。有可能在不更改smtp憑證的情況下更改發件人地址。laravel 5.4更改「從地址」而不更改smtp用戶名
我已經在config/mail.php中設置了從地址。但在郵件中,地址是smtp用戶名。有可能在不更改smtp憑證的情況下更改發件人地址。laravel 5.4更改「從地址」而不更改smtp用戶名
.ENV文件
MAIL_DRIVER=smtp
MAIL_HOST=HOST_NAME
MAIL_PORT=PORT
MAIL_USERNAME=USERNAME
MAIL_PASSWORD=PASSWORD
MAIL_FROM_ADDRESS=FROM_EMAIL_ADDRESS
MAIL_FROM_NAME=YOUR_NAME
配置/ mail.php
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
// 'from' => ['address' => null, 'name' => null],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', null),
'name' => env('MAIL_FROM_NAME', null)
],
你應該試試這個:在配置/
僅僅只改變mail.php從陣列狀
'from' => [
'address' => env('MAIL_FROM_ADDRESS', null),
'name' => env('MAIL_FROM_NAME', null)
],
清除緩存後並嘗試:
php artisan cache:clear
php artisan config:cache
php artisan cache:clear
希望爲你工作!!!
https://laravel.com/docs/5.3/mail#configuring-the-sender – aynber
我已經根據文檔進行更改,因爲您發送上述鏈接。但它從地址採取smtp用戶名。 –
如果您通過Gmail發送郵件,它們會覆蓋發件人。其他主要提供者可能也會做類似的事你可以設置一個'Reply-To'頭,或者通過一個不同的提供者來發送,比如Sendgrid。 – ceejayoz