samedi 30 janvier 2016

Error : Configuring Email in Laravel 5 Project

I am using email service to confirm user's registration to my new website. I heard some folks said about configuring the email setting in .env and config/mail.php . I've configured it using gmail setting with this:

my .env file:

APP_ENV=local
APP_DEBUG=true
APP_KEY=eN3KtYOe7uNiYwFLgoZDQEPf4YC85HFc

DB_HOST=localhost
DB_DATABASE=mydatabase
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
SESSION_DRIVER=file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mygmailaccount@gmail.com
MAIL_PASSWORD=__myGmailPassword__
MAIL_ENCRYPTION=tls

My config/mail.php file:

<?php

return [

    'driver' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => 587,
    'from' => ['address' => 'mygmailaccount@gmail.com', 'name' => 'somename'],
    'encryption' => '',
    'username' => 'mygmailaccount@gmail.com',
    'password' => '__mygmailpassword__',
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => false,
];

After i tried to login, i got this error :

Swift_TransportException in AbstractSmtpTransport.php line 383:

Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. h66sm30269295pfj.52 - gsmtp

What could possibly wrong? How to make it works? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire