Ad

Laravel Mail From Not Set

- 1 answer

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.

Ad

Answer

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)

Ad
source: stackoverflow.com
Ad