2

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 :)

EDIT : With gmail, I activated two step verification, I also used : php artisan config:cache and php artisan config:clear

Kokno
  • 185
  • 1
  • 1
  • 8
  • 1
    have a look at this http://stackoverflow.com/questions/32693528/expected-response-code-220-but-got-code-with-message-in-laravel/32696418#32696418 – Sid Dec 24 '15 at 13:54
  • I already have the two-step verification, and I also tried with a dedicated mail server (not gmail). I tested this solution, and it still doesn't work ): – Kokno Dec 24 '15 at 14:04
  • when I choose "log" for the driver, it seems to be working – Kokno Dec 26 '15 at 12:30

0 Answers0