Sven van den Boogaart
Sven van den Boogaart

Reputation: 12331

Laravel mail from not set

For my website I try to send emails from an alias (created alias from google for business). My mail function:

Mail::send('emails.tracktrace', ['text'=>$mailtext,'tracking' => $code,'email' => $email, 'name' => $name], 
function ($m) use ($code, $email, $name) {
        $m->from('[email protected]', 'Mydomain');
        $m->to($email, $name)->subject('Track your package!');
});

Also in my config/mail.php I have:

'from' => ['address' => '[email protected]', 'name' => 'mydomain'],

But both are ignored and the MAIL_USERNAME value set in my .env file (with the mail configuration) is used.

Upvotes: 1

Views: 1449

Answers (1)

Arno van Oordt
Arno van Oordt

Reputation: 3520

I ran into the same problem.. Turned out I tried to use a Gmail account which doesn't let you change the 'from' headers. (see problem with php mail 'From' header)

Upvotes: 1

Related Questions