Laravel using send email using email host smtp.office365.com - laravel

I got this error in laravel 6 right now,..
it is work in Gmail but in office365 i got this error.
". Authenticator XOAUTH2 returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [xxx.xxx.xx.outlook.com]
"
this is my .env.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME="xxxxx#xxxxx.com"
MAIL_PASSWORD="xxxxxx"
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="xxxxx#xxxxx.com"
MAIL_FROM_NAME="xxxx#xxxx.com"
Does anyone can solve this? :(

Related

Laravel Email Sending - Expected response code 220 but got an empty response

I have an application which auto send email to users at scheduled time. However, there is such error occasionally (Sometimes work and sometimes don't work) :
Expected response code 220 but got an empty response {"exception":"[object] (Swift_TransportException(code: 0): Expected response code 220 but got an empty response at /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:447)
MAIL_MAILER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=XXX
MAIL_PASSWORD=XXX
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=XXX
Is there any settings issue in mail server which is causing this ?

Error sending mail with Laravel app/Gmail in production

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.

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.

Configure email delivery in laravel?

I am doing send email in laravel.
I configured gmail sending and it sent email successfully.
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxxx#gmail.com
MAIL_PASSWORD=xxxxxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=xxxxxxx#gmail.com
MAIL_FROM_NAME="${APP_NAME}"
Now i send my company email: reply#jct.com
MAIL_MAILER=smtp
MAIL_HOST=smtp.jtc.com
MAIL_PORT=587
MAIL_USERNAME=reply#jct.com
MAIL_PASSWORD=xxxxxx
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=reply#jct.com
MAIL_FROM_NAME="${APP_NAME}"
But I can't send email. It reports an error:
Failed to authenticate on SMTP server with username
"reply#jct.com" 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.
Please show me where did I go wrong. Thank you.

Resources