Hi i am trying to send emails in laravel.But when trying to send it is genrating following error and mails are not sending. But everything worked fine in localhost without any problems.
Failed to authenticate on SMTP server with username "lifeloveandotherthings94@gmail.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data
". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data"
Following is my code in .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=MyEmailPassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=noreply@lifelove.com
MAIL_FROM_NAME='LifeLoveAndOtherThings'
I havent added additonal code in config/mail.php
'stream' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
],
I havent changed or added my emails in config/mail.php.I have set it up only in .env file. What is the issue here.
it was solved in my case by disabling the SMTP restriction option from WHM.enter image description here
For me, this was my problem
Authenticator XOAUTH2 returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful
This happened suddenly after a few month in production (before it worked perfectly). After having visited other post with similar question, none of which worked, the solution that I found was...
to change the password and WAIT SOME TIME in order to be effective.
I know, I know
I think that the password on outlook was expired after some time. The config was the same.
The way you can do if you are using cpanel/whm :
Hope this will help you :)
I have a similar error and I enquoted my password and it worked like charm.
MAIL_PASSWORD="YourEmailPassword"
If the problem still continues try using username, password and port number in double quotes.
If you are using your personal Gmail account then follow these steps :
If you have already followed these steps, try re-starting your project. and if it still doesn't work, please continue these steps :
Good luck!
Try to solve it using either of these: Your .env should be something like this..
This if for domain email
MAIL_DRIVER=mail
MAIL_HOST=mail.yourdomain.com
MAIL_PORT=465
MAIL_USERNAME=yourdomain.com
MAIL_PASSWORD="password"
MAIL_ENCRYPTION=ssl
MAIL_FROM_NAME="${APP_NAME}"
This if for Gmail email
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=youremail@gmail.com
MAIL_PASSWORD="yourPassword"
MAIL_ENCRYPTION=ssl
MAIL_FROM_NAME="${APP_NAME}"
The second option Change
MAIL_ENCRYPTION=ssl
to
MAIL_ENCRYPTION=tsl
Or vice versa
The 3rd option
Allow less secure apps in you email
I hope it solve your problem