Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel SwiftMailer : Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required

I am using laravel 5.2, And the using Swift Mailer for password resetting. I have 2-step verification on my gmail..

As the google help says :


If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password.


I have the following settings on mail.php :

return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.gmail.com'),
    'port' => env('MAIL_PORT', 465),
    'from' => ['address' => '[email protected]', 'name' => 'Shafee'],
    'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
    'username' => env('[email protected]'),
    'password' => env('MY_Gmail_API_KEY'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => env('MAIL_PRETEND', false),

];

On the .env i have :

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

The following error comes up :

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/answer/14257 w10sm15831823wjk.18 - gsmtp
"
like image 849
Gammer Avatar asked May 26 '16 19:05

Gammer


1 Answers

Use tls instead of ssl and use port 587.

Use key or paasword.

Or Please run php artisan config:cache

Or Try to turn on "less secure apps" of your account on this page.

like image 64
Laravel User Avatar answered Sep 30 '22 21:09

Laravel User