Configure email delivery in laravel? - 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.

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 ?

Connection could not be established with host smtp.office365.com :stream_socket_client(): php_network_getaddresses

I'm getting this error when sending an email via Office 365 from a Laravel system.
But the peculiarity is that it is random. It is not a mail configuration problem. Sometimes it works, sometimes it gives the error.
I think Office 365 is doing a lock. But the error message confuse me.
Has it happened to someone? Thanks!
Connection could not be established with host smtp.office365.com :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known site:stackoverflow.com
if you are sure that you configure the mail correctly
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME= //your username
MAIL_PASSWORD= //your password
MAIL_ENCRYPTION=tls
according to this issue discussions, it seems that it may related to WHM/Cpanel Users-- there is a tweak setting that may be tripping you up and redirecting outgoing email connections to localhost (which is then rejecting your connection).
https://features.cpanel.net/topic/change-fka-smtp-tweak-behavior-to-encourage-correct-user-behavior
if your are using GoDaddy Linux hosting try this:
mail_mailer=smtp
mail_host=localhost //using localhost cause we are in the same domin
mail_port=25
mail_username= //keep it empty
mail_password= //keep it empty
mail_encryption= // keep it empty
mail_from_address=username#udomin.com//this same for your email username
mail_from_name=stackoverflow // any name
see we are use this setting because we are in the same serve

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 using send email using email host smtp.office365.com

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? :(

Resources