I'm using Laravel 5.2 and google app for my email . I try connect my website in my google app with smtp but i have this error Failed to authenticate on SMTP server with username "email@domaine.com" using 3 possible authenticators
in my config/mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp-relay.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'email@domaine.com', 'name' => null],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => 'email@domaine.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
]
Not sure if this is your case, but, note that if you have 2 Factor Authentication enabled on your Google Account, you will have to create an application password to use in your Laravel application, your main password won't work .
Not sure if this is your case though but something like this did happened to me once.
In my case, it was not enought to set the params in the config/mail.php file. I had to set the params in the .env file.
I found this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
and I set this instead:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.domain.com
MAIL_PORT=587
MAIL_USERNAME=user@domain.com
MAIL_PASSWORD=my_password
MAIL_ENCRYPTION=tls
Then it worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.