jeudi 30 août 2018

Laravel set from address email

Please help me, i try using Laravel to send email but i want when receive email, it will show fromEmail. I had set $messavge->from() but it get MAIL_USERNAME. It get name 'test' but from Address 'testemail@gmail.com'.

ENV

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=testemail@gmail.com
MAIL_PASSWORD=yhhbytlrqldnccig
MAIL_ENCRYPTION=tls

Config mail

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

Code

 Mail::send('order::admin.email-confirm-order', $data, function ($message) use ($data) {
                    $message->from('abc@gmail.com', 'test');
                    $message->to($data['user_email']);
                    $message->cc($data['email_cc']);
                    $message->subject($data['order_code'] );
                });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire