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

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 ?

Related

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.

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

Expected response code 354 but got code "503", with message "503 5.5.1 RCPT first. w15sm3670747wrs.80 - gsmtp "

I am using Laravel 5.8 and I am trying to send email from system using below setting.
when is send email one by one its working fine but when I send bunch of marketing email together it stopped after sending 20 email and giving me below error.
I am using below setting in .env.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=my user name
MAIL_PASSWORD=my gmail app password
I am getting below error after sending 20 emails
Expected response code 354 but got code "503", with message "503 5.5.1 RCPT first. w15sm3670747wrs.80 - gsmtp "
also I tried with TLS but it's giving me same error after 20 emails...
All email senders have a limit of how many emails can be sent in a particular second.
Amazon's SES, for example, has limit of 40 emails per second.
I am using this logic to solve this issue:
$count = 0;
foreach ($users as $user) {
$count++;
$user->notify(
(new Notification($emailBody))
->delay(intdiv($count,30))
);
}
It sounds like you have a bug where you are sending a DATA command without first sending a valid RCPT TO command. That might mean that none of your RCPT TO commands were accepted by the server. I suggest tracing the entire SMTP conversation so you can see how that might be happening.

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.

Resources