Occasional 'Connection Refused' errors from Office 365 SMTP Server

Hi,

We're using an Office 365 account to send emails via the smtp.office365.com:587 SMTP server.

This is working fine most of the time, but occasionally we're getting a 'Connection Refused' error.

Can you give us any indication about what might cause this error?

Thanks

John

 

Question Info


Last updated March 17, 2020 Views 3,823 Applies to:

hi john,

to better help you, please confirm what your detailed symptom is. you can provide the following information so that we can have a better understanding:
1. the detailed steps about “using an office 365 account to send emails via the smtp.office365.com:587 smtp server”.
2. the complete 'connection refused' error. the related screenshot is also welcomed. to upload a screenshot:


3. for “connection refused” error, whether there is any non-delivery report (ndr). if so, please provide the complete ndr within 3 days in the private message for protecting your privacy. you can click the following link to see the pm.
community.office365.com/.../conversations

regards,
alan

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

The following is from our trace code. The top section shows a successful connection to the SMTP server. This happens most of the time, and the email is successfully sent.

The second block is from the same trace output file and shows the SMTP server refusing the connection, before any sort of handshake or authentication has taken place. We retry the connection four times before showing an error message to our user.

-----------------------------------------------------------------------

24:05:2016 14:01:06 Hhsmtp32.dll: HhsSmtp() Enter

24:05:2016 14:01:06 Hhsmtp32.dll:

SMTP Server:smtp.office365.com

SMTP Account:********

SMTP Password:********

24:05:2016 14:01:07 Hhsmtp32.dll: Connecting to mail server.

24:05:2016 14:01:07 Hhsmtp32.dll: Connected.

24:05:2016 14:01:07 Hhsmtp32.dll: 220 connDB4PR04CA0018.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 24 May 2016 13:01:08 +0000

24:05:2016 14:01:07 Hhsmtp32.dll: EHLO UKHYDIT056275

24:05:2016 14:01:07 Hhsmtp32.dll: 250-DB4PR04CA0018.outlook.office365.com Hello [86.188.136.131]

-----------------------------------------------------------------------

24:05:2016 14:07:46 Hhsmtp32.dll: HhsSmtp() Enter

24:05:2016 14:07:46 Hhsmtp32.dll:

SMTP Server:smtp.office365.com

SMTP Account:********

SMTP Password:********

24:05:2016 14:07:53 Hhsmtp32.dll: Connecting to mail server.

24:05:2016 14:07:54 Hhsmtp32.dll: Connecting to mail server.

24:05:2016 14:07:55 Hhsmtp32.dll: Connecting to mail server.

24:05:2016 14:07:56 Hhsmtp32.dll: Connecting to mail server.

24:05:2016 14:07:57 [10061] Connection refused

Reported by: Hhsmtp32.dll (Error number 10061)

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi John,

Thanks for providing the detailed trace codes. But we still need to know more about how you set up the entire SMTP procedure.

Regarding “using an Office 365 account to send emails via the smtp.office365.com:587 SMTP server”, I suppose this is an SMTP email relay scenario. We support 3 relay options which are introduces here: How to set up a multifunction device or application to send email using Office 365. Can you please help us clarify which option you’re using?

Regards,
Rick

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Thanks for the reply Rick. We are using Option 1 - we authenticate our helpdesk application directly with an Office 365 mailbox and send mail using SMTP client submission.

Option 1 (recommended): Authenticate your device or application directly with an Office 365 mailbox, and send mail using SMTP client submission

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi John,

Thanks for the clarification.
I have read the whole thread and found that you didn’t mention any detailed settings about the helpdesk application. So I cannot try reproducing it. let’s focus on the “Connection Refused” errors.

From the trace code, we can see that when the client submitted a request for establishing connection, our SMTP server returned “hello” and wait for the client confirmation. And then the issue occurs. It seems that the server doesn’t receive the confirmation and close the connection.

For the SMTP client submission option, Office 365 require your device or applications supporting TLS and Office 365 username and password for authentication
As far as I Know, many devices don’t support this for sending email alerts. To narrow down this issue, we need confirm these points below:
1.  Please check your firewall to ensure the outbound port 25 is opening
2.  Try the port 25 instead of 587 for the smtp.office365.com to see if it can be improved.
3.  Disable the antivirus software on your computer and try connecting to the smtp server.
4.  Make sure your helpdesk application support TLS1.0 or above.

However, please share the detailed SMTP settings to us.
 
Thanks,
Rick

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Port 25 doesn't work for smtp.office365.com - it returns an authentication error - I'm guessing because the SMTP server requires SSL/TLS. We are passing across login and password information each time.

We have tried using port 465, which is the usual SMTP SSL/TLS port, and this works for a while, then we get Connection Refused errors again.

2 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Hi John,

Thanks for your efforts and feedback.

Since you are using SMTP client submission, we need to confirm these points below:

1. Whether your Office 365 mailbox can send and receive email from Outlook client and OWA (Outlook for Web App)?

2. If the port 25 or 587 can be used?

3. If your helpdesk application support TLS?

If all the above is true (Obviously, we have found answer from the trace code and the last post) but the issue persists, the root cause may be related to your device or app and you may ask others for further assistance.

For my personal advice, you may contact your DNS host provider to check if they change any settings of the firewall.

Regards,

Rick

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

No, the root cause is simply the Office 365 SMTP service. It is intentionally slow(!) and sometimes refuses connections (probably some connection limit filtering going on).

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.