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
"
MY_Gmail_API_KEY
an actual API key? I've always just used the google password for the account in the username field ([email protected]
). – Refractorypassword
both in.env
andmail.php
? – PeroMY_Gmail_API_KEY
is the App password? That's what it should be, but I personally wouldn't call it an API key. – Refractory