Unable to send mail at the right time can even result in the loss of a major business opportunity.
Quite frustrating! we know.
And, when error messages contain technical jargons, it becomes more frustrating.
One such error is “failed to connect socket connection timed out“.
Fixing email delivery problems of our customers is one of the common tasks that we do as part of our Outsourced Technical Support Services for web hosts.
Today, we’ll discuss the top 4 reasons for this error and how we fix it.
Failed to connect socket: Connection timed out – What this means?
Simply put, the socket is the end point of communication.
In a normal mail delivery, the client socket connects to a listening server socket. And, communication happens once this connection is successful.
‘failed to connect socket connection timed out’ means that the connection to the mail server fails or the mail server can no longer be reached.
Failed to connect socket: Connection timed out – Causes and Fixes
Now let’s see the main reasons for this error and how our Support Engineers fix them.
1) Wrong SMTP host and port
Users should enter the mail server details in their email application.
For example, if they use Gmail as the email server, the SMTP host should be smtp.gmail.com.
Sometimes, a typo in the hostname or an inactive mail server can result in this error.
Similarly, the default SMTP port is 25, but some email providers use custom ports such as 587 to reduce spam.
In addition to that, some mail servers only allow emails via SSL port 465.
So, incorrect SMTP host or port entry in the SMTP settings of the email application can cause email delivery errors.
Solution
Firstly, out Support Engineers check the DNS connectivity of the mail server with the below command.
dig mail.domain.com
Further, to identify the correct SMTP port and it’s connectivity, we use the below command.
telnet mail.domain.com 25
Later, we check and verify that correct SMTP settings are used in the email application.
[Trouble with your emails and can’t identify where it went wrong? Don’t worry our Support Engineers can help you here.]
2) Server firewall restrictions
Firewalls play a crucial role in server security. These firewalls can sometimes block access to some IPs or IP ranges based on the abnormal behavior.
For example, some servers block access from the IP address, if the number of connections from that IP address exceeds the threshold value.
So, if the firewall doesn’t allow connection, users will see the error ‘failed to connect socket connection timed out’.
Solution
Firstly, our Support Engineers check and verify that the user’s IP address is blocked in the server firewall. We use online tools like https://whatismyipaddress.com/ to get the public IP address of the customer.
If the IP address is blocked in server firewall, we immediately remove it and restore the email connectivity. After that, we identify the reason for the firewall block and inform the customer.
Additionally, we whitelist the IP address in the server for a certain period of time, after confirming that it’s a legitimate request.
3) ISP port blocks
The default SMTP port is 25. But, most of the ISPs block this port to curb spam and abuse.
And, this is another common reason for the error.
Solution
Our Support Experts check the traceroute results from user’s PC to the mail server.
This gives an idea of network connectivity issues in any of the intermediate networks between the mail server and user PC.
If we find problems at the ISP level, we suggest customers to contact them.
Alternatively, we configure the mail server at alternate ports such as 587 to override ISP port blocks and restore email delivery.
Once the mail server is configured on the new port, we whitelist that port in the firewall to allow incoming connections.
4) PC firewall issues
This can happen at times.
Antivirus software or third party firewalls on the user’s PC can sometimes block connections to certain IPs, including the server IP.
As a result, it can give error while connecting to the mail server from the user’s PC.
Solution
To check the connectivity problems from user’s PC to mail server, we get the telnet results from the user’s PC to mail server port.
In this way, we identify if the user can connect to the SMTP port of the mail server.
If the connection fails, we suggest the customers to disable local firewall and antivirus and give a try.
[Need help solving your ongoing email problems? Click here to get a Support Expert to look in your issue.]
Conclusion
In short, ‘failed to connect socket connection timed out error’ can occur due to wrong SMTP host or port settings, ISP firewall blocks and more. Today, we’ve discussed the top 4 reasons for this error and how our Support Engineers fix them.
Thanks for your help