lundi 9 mars 2020

laravel 5 smtp mail not sending even after changing less secure app

I have already changed gmail Less secure app ON (at gmail setting) and my .env as following

MAIL_DRIVER=smtp
MAIL_ADDRESS=rejoanul.alam@gmail.com
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_PASSWORD=myPass
MAIL_ENCRYPTION=tls

After that my controller as following

    try {
      Mail::send('admin.users.email', $requestData, function ($message) use ($request) {
      $message->from(env('MAIL_ADDRESS'), 'Rejoan');
      $message->to(trim($request->input('email')))->subject('Account Updated');
     });
    }catch (\Exception $e) {
     echo $e->getMessage();return;
    }

Every tie it is showing following error

Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not >accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials t11sm18420889pjo.21 - gsmtp "

My laravel version is 5.2, What I am doing wrong. Also tried by enable 2 step verification with app password option but not worked.

Is guzzle related issue? my compoer showing "guzzlehttp/guzzle": "^6.5"

When I try with PHPMailer library then work but laravel mail not working



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire