mardi 6 septembre 2016

Laravel Sender or From not working as expected

I have this issue in the laravel 5.1 mail. Though I already assigned a different email, it is still getting the smtp user address. To explain more here are my configs:

in my .env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_FROM_ADDRESS=whatiwant@mydomain.com
MAIL_FROM_NAME=myname
MAIL_USERNAME=validgmail@gmail.com
MAIL_PASSWORD=mypassword

my code for sending mail

$message->from(getenv('MAIL_FROM_ADDRESS'), getenv('MAIL_FROM_NAME'));
$message->sender(getenv('MAIL_FROM_ADDRESS'), getenv('MAIL_FROM_NAME'));
$message->to($to, $name)->subject($subj);

in my config/mail

'from' => ['address' => getenv('MAIL_FROM_ADDRESS'), 'name' => getenv('MAIL_FROM_NAME')],

So supposedly when it was sent to the recipient it should show that the sender now will be from "myname<whatiwant@mydomain.com>" instead it shows "myname<validgmail@gmail.com>".

PS: In gmail their's an option to Show Original and from there it shows this:

Received: from local.com ([my_ip])
        by smtp.gmail.com with ESMTPSA id *******
        for <recipient@gmail.com>
        (version=TLS1 cipher=**** bits=128/128);
        Tue, 06 Sep 2016 20:25:36 -0700 (PDT)
From: myname <validgmail@gmail.com>
X-Google-Original-From: myname <whatiwant@mydomain.com>

Please help..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire