jeudi 24 décembre 2015

Try to send mail with Laravel 5.0 but got error "Expected response code 220 but got code "", with message """

I'm working with Laravel 5.0 and I would like to send mail in my Controller. For the moment I'm testing with this code :

Controller

Mail::send('emails.test', ['key' => 'value'], function($message)
    {
        $message->to('adress@gmail.com', 'Name')->subject('Test!');
    });

And I have a simple view but it's not the problem. The problem is I got an error when sending the mail :

Expected response code 220 but got code "", with message ""

I don't understand why it doesn't work, I test with a dedicated mail server and with gmail (see configuration below)

.env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myadress@gmail.com
MAIL_PASSWORD=mypassword

mail.php

return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'adress@gmail.com', 'name' => 'Name'],
'encryption' => 'ssl',
'username' => env('USERNAME'),
'password' => env('PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];

I already search on Internet the solutions but none of them are working. My application is run on WAMP (localhost)

Thanks in advance :)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1YDN6mH
via IFTTT

Aucun commentaire:

Enregistrer un commentaire