samedi 21 novembre 2015

Email send issue in Laravel 5.1

I am using laravel 5.1 and i'm trying to send email from laravel application from localhost.

I have been configure my Email Credentials in .env file But, i'm getting Authentication required Error. I'm attaching code of .env file and controller file.

.env

APP_ENV=local
APP_DEBUG=true
APP_KEY=1MJzLfnALmtppcbfzoVtlf8rzsFX94nm

DB_HOST=localhost
DB_DATABASE=real_estate
DB_USERNAME=root
DB_PASSWORD=''

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=my_account@gmail.com
MAIL_PASSWORD=my_password
MAIL_ENCRYPTION=ssl

Controller code

$subject = 'Welcome!';
    Mail::send('mail', ['key' => 'value'], function($message) use ($subject) {
    // note: if you don't set this, it will use the defaults from config/mail.php
    $message->from('my_account@gmail.com', 'Sender Name');
    $message->to('receiver_account@gmail.com', 'John Smith')
            ->subject($subject);
    });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire