lundi 7 mai 2018

Getting exception when sending email

Hello everyone I am trying to send an email in Laravel and after using so many configurations and getting same exception each and everytime I am posting here the exception I am getting is.

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

Steps I used in configuring Mail in Laravel are following.

I enabled google two steps verification. Changed the .env file with the following MAIL variables.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email@domain.com
MAIL_PASSWORD=email_password
MAIL_ENCRYPTION=tls

And lastly in my config/mail.php file I change setting like this.

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,
];

And here is the function I am using to send email

$mail = Mail::raw($msg, function ($message) {
   $message->to('email@domain.com');
});

Can anyone guide me that what I am doing wrong



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire