Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel 5.4 : Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at

i'm testing password reset in laravel 5.4 and i got this error :

    Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at
530 5.5.1 https://support.google.com/mail/?p=WantAuthError j71sm516784wmd.12 - gsmtp
"

here is my .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=ssl

and my mail.php

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

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

'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),

'name' => env('MAIL_FROM_NAME', 'from me'),

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

'username' => env('[email protected]'),

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

i Tryed to turn on "less secure apps" of my gmail account.nothing change
How do I resolve this error message? could anyone help me please !!!

like image 359
abdel diwat Avatar asked Dec 23 '22 18:12

abdel diwat


2 Answers

I have solved this by changing:

'username' => env('my-email'),
'password' => env('my-password'),

to

'username' => 'my-email',
'password' => 'my-password',
like image 125
Oleksandr Avatar answered Dec 28 '22 07:12

Oleksandr


I ran into a similar problem and what i did was
go to google settings for enabling 2 step varification from here or follow this

after turning on 2 step verification App Password link will appear right below 2 step verification. Which will take you to this link

Then create your app password by following the process

then copy the app password that is generated and paste it in your .env file like follows

MAIL_DRIVER=sendmail
[email protected]
MAIL_FROM_NAME=DomainName
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=YOUR_GMAIL_CREATED_APP_PASSWORD
MAIL_ENCRYPTION=tls

also be sure to check both smtp and sendmail in MAIL_DRIVER
Also run php artisan config:cache
Hope this will help

like image 23
Regolith Avatar answered Dec 28 '22 07:12

Regolith