Expected Response Code 220 But Got Code "", with Message "" in Laravel

Expected response code 220 but got code , with message in Laravel

This problem can generally occur when you do not enable two step verification for the gmail account (which can be done here) you are using to send an email. So first, enable two step verification, you can find plenty of resources for enabling two step verification. After you enable it, then you have to create an app password. And use the app password in your .env file. When you are done with it, your .env file will look something like.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=<<your email address>>
MAIL_PASSWORD=<<app password>>
MAIL_ENCRYPTION=tls

and your mail.php

<?php

return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '<<your email>>', 'name' => '<<any name>>'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,

];

After doing so, run php artisan config:cache and php artisan config:clear, then check, email should work.

Expected response code 220 but got an empty response in laravel 5.6

Just run this code on the terminal:

php artisan config:cache

Laravel: Expected response code 220 but got code , with message

Finally fixed my issue.

I had to change MailTrap configuration

from

MAIL_PORT=2525

to

MAIL_PORT=465

Thanks to @Manish for spotting that in the comments.

Laravel 5.2: Expected response code 220 but got code 500 , with message 500 Unrecognised command

MailHog does not support TLS encryption. Adding MAIL_ENCRYPTION=

MAIL_ENCRYPTION=

error Message: Expected response code 220 but got an empty response with exception Swift_TransportException ,

I think I can figure out your problem here. What you need to do is to make a strict setting to comply with the mail.php

return [

'driver' => env('MAIL_DRIVER', 'smtp'),

'host' => env('MAIL_HOST', 'smtp.gmail.com'),

'port' => env('MAIL_PORT', 587),

'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'username@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Payne Curtis'),
],

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'username' => env('MAIL_USERNAME'),

'password' => env('MAIL_PASSWORD'),

'sendmail' => '/usr/sbin/sendmail -bs',

'markdown' => [
'theme' => 'default',

'paths' => [
resource_path('views/vendor/mail'),
],
],

'log_channel' => env('MAIL_LOG_CHANNEL'),
];

Therefore change your .env to the following;

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=abdulkabirojulari@gmail.com
MAIL_PASSWORD=gjcltiocmmqoutfi
MAIL_ENCRYPTION=tls

MAIL_ENCRYPTION=tls is very essential and needs to be added to the .env file



Related Topics



Leave a reply



Submit