0

I've got a class that extends Mailable where I use in it :

return $this->subject($this->email->subject . ' | ' . $this->email->name)
            ->from($this->email->email, $this->email->name)
            ->replyTo($this->email->email, $this->email->name)
            ->to('XXX@gmail.com')
            ->view('guest.mail');

This is just the classic way of sending an email. The problem I'm having is that in Gmail I get a weird message that has the from field not using $this->email->email but rather using XXX@gmail.com (which is also my MAIL_USERNAME field in my .env).

I have no idea why. The reply to is working correctly, subject as well. It's just that the from in the email I get looks as if it was sent by XXX@gmail.com for no logical reason to me.

Any idea what would be the issue? Did anyone ever come across an issue like that with Gmail?

Alexandre Elshobokshy
  • 10,720
  • 6
  • 27
  • 57
  • Gmail override whatever value you have set with default values – Foued MOUSSI Apr 18 '20 at 21:54
  • Why would it overwrite the default from value to the current email? Do you have a source? Any idea on how to go around this? @FouedMOUSSI – Alexandre Elshobokshy Apr 18 '20 at 21:56
  • 1
    In the case of google SMTP, the from address won't change even if you give this in the mail class. This is due to google mail's policy, and not a Laravel issue. Thought I will share it here. – Foued MOUSSI Apr 18 '20 at 21:56

0 Answers0