我在config / mail.php中设置了from地址。但是在邮件中,来自地址的是smtp用户名。是否可以在不更改smtp凭据的情况下更改发件人地址。
答案 0 :(得分:1)
.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
config / 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)
],
答案 1 :(得分:0)
你应该试试这个:
只需在数组中更改config / 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
希望这对你有用!!!