Error sending mail with Laravel app/Gmail in production - laravel

I have this error when I try to send mail with Laravel 9 app using Gmail:
Failed to authenticate on SMTP server with username "*************#gmail.com" using the following authenticators: "LOGIN", "PLAIN", "XOAUTH2". Authenticator "LOGIN" returned "Expected response code "235" but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor h4-20020a056830034400b0060603221274sm8631029ote.68 - gsmtp".". Authenticator "PLAIN" returned "Expected response code "235" but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor h4-20020a056830034400b0060603221274sm8631029ote.68 - gsmtp".". Authenticator "XOAUTH2" returned "Expected response code "235" but got code "334", with message "334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==".".
This is my .env configuration.
MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=************#gmail.com
MAIL_PASSWORD=************
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=************#gmail.com
MAIL_FROM_NAME="Claims - *****"
I've been reading, and apparently since 5/22/2022 you can no longer activate the option to allow access to less secure applications in Gmail... so, how can we solve this? is this really my problem or another?

google recently changed there security protocol about less secure apps, that's why it's showing the error.

Related

Laravel Email is not sending due to the Failed to authenticate on SMTP server with username

I have a problem when I send mail from localhost everything works fine, but when sending from the server I don't receive mail and I get an error. Failed to authenticate on SMTP server with username please help me how can resolve that? thanks.
please check the error thanks.
https://flareapp.io/share/RmrlNRN7
Swift_TransportException
Failed to authenticate on SMTP server with username "zubair.bhw#gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor c25sm22236461edt.0 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials c25sm22236461edt.0 - gsmtp ".
https
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=zubair.bhw#gmail.com
MAIL_PASSWORD='12345678'
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=zubair.bhw#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
MALE_TO=zubair.bhw#gmail.com
Try port 465 instead of 587 as Gmail normally uses that one. Check if
port is blocked on your live server. Login to your gmail account(
mygmail#gmail.com ). Go to https://myaccount.google.com/security ,
Scroll down till bottom of page. In right you will see: Allow less
secure apps, make sure that option is on.

How to send Laravel Mail using Outlook?

I want to send mail when user registred but i got this error.
Failed to authenticate on SMTP server with username "*****" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful ". Authenticator NTLM returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful ".
How can i solve this?
Here is my mail configuration :
MAIL_DRIVER=smtp
MAIL_HOST=*****
MAIL_PORT=25
MAIL_USERNAME=****
MAIL_PASSWORD=****
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=covid19#sante.gouv.dj
If this is for Office 365 (since you tagged your question as "outlook" even though it has nothing to do with Outlook), then you need to use TLS on port 587 to connect to smtp.office365.com. Authentication is OAuth2.

Laravel Failed to authenticate on SMTP

when I am trying to send an email with sendgrid I have got this error. How can I solve it?
Failed to authenticate on SMTP server with username "dfadsfasdf" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 250 but got an empty response. Authenticator PLAIN returned Expected response code 250 but got an empty response.

Am experiencing issues with email delivery-"response code 250 but got code '550' "

I am using Exim mail server for my smtp and experiencing an issue when sending emails from the server if the connection is instantiated from within the server. However if I try authenticating from outside, emails are sent without any problems. Am using Laravel which ships with Swift mailer. This is the error laravel is giving out.
production.ERROR: Expected response code 250 but got code "550", with message "550 127.0.0.1 is _my_ address
Exim's log also has a similar error;
H=localhost [127.0.0.1] X=TLSv1:ECDHE-RSA-AES256-SHA:256 CV=no rejected MAIL <no-reply#mydomain.com>: 127.0.0.1 is _my_ address
My .env file has credentials set up correctly as follows
MAIL_DRIVER=smtp
MAIL_HOST=mydomain.com
MAIL_PORT=587
MAIL_USERNAME=no-reply#mydomain.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
The code used to send the emails is as below;
Mail::to('admin#mydomain.com')->send(new AlertEmail($information));
What am wondering is,could the problem be caused by trying to send the email to addresses within the same domain? I hope someone can help me out. Am almost going crazy.
NB: Roundcube is sending emails fine.

LARAVEL MAIL: Expected response code 250 but got code "", with message ""

I can send email in my localhost, but when I put it in our remote server I get this error:
I don't know what the problem is. Anyone?
I used the laravel default mail driver which is swiftmailer.
Check your gmail: in settings, enable access for less secure apps and it will work.

Resources