I am using Laravel 6.2 now. I am sending the email using below code.
Mail::send('emails.sample',[],function($message) use($subject)
{
$message->subject($subject);
$message->from('test@example.com', 'supplier');
$message->to('user@hotmail.com'); // or user@gmail.com
});
My .env is the following.
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.myhost.server.com
MAIL_PORT=587
MAIL_USERNAME=test@example.com
MAIL_PASSWORD=password
MAIL_FROM_ADDRESS=test@example.com
MAIL_FROM_NAME=supplier
And config/mail.php is the following
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'test@example.com'),
'name' => env('MAIL_FROM_NAME', 'supplier'),
],
but after receiving the email, sender email address is coming like this
supplier <xxx@myhost.server.com>
As you see, changed sender name. but didn't changed sender email.
It should be supplier <test@example.com>
.
How do I fix this? Any suggestions, Please!
King Regards!!!