2

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!!!

WangYang
  • 21
  • 3
  • Maybe sendmail adjusts the address? What happens when you set your driver to SMTP? – Maarten Veerman Jun 12 '20 at 04:52
  • Do you have SPF/DKIM DNS records set for your domain? `example.com` will need to have those records set for mail clients to verify that mail coming from `smtp.myhost.server.com` is legitimate email. Otherwise, the mail client might only show the domain of the server that sent the message. – zeterain Jun 12 '20 at 04:56
  • Seems relate to your smtp host as it's expected that sender has the same domain – Pedro Sanção Jun 12 '20 at 10:27

0 Answers0