SMTP Error (-1): Connection to server failed.
That was an error message our customer recently got while trying to send mails via Roundcube.
Usually, this error occurs due to firewall restrictions, mail server malfunctioning, and so on.
At Bobcares, we often get requests to fix SMTP errors, as a part of our Server Management Services.
Today, let’s have a look into the error and see how our Support Engineers fix it.
What is SMTP error -1?
Basically, SMTP is the Simple Mail Transfer Protocol. The mail server connects with each other using this protocol. Since mail services are critically important, errors in this can be totally frustrating.
One of our customers had a LAMP server, with Postfix and Roundcube for mail services. But, while trying to send a mail via Roundcube, he got the error:
The error message clearly indicated that the Mail client could not connect with the server. Initially, we checked the mail log. This gave more details about the error.
Causes and fixes for the SMTP error -1
Usually, there are several reasons that lead to the SMTP error. Let’s see how our Support Engineers fix these causes.
1. SSL/TLS certificate expired
Some customers approach us with the SMTP error -1 when they try to send mails using mail clients. Here the first login to the Mail client shows the error message.
Connection to storage server failed
And when the user tries to send an email, they get the SMTP error -1.
Most often, this situation indicates that the SSL/TLS certificate expired.
So, we check the certificate of the mail server. If it was found expired, we update it.
2. Errors in Mail server
In some cases, if the mail server do not work properly, then the same error shows up. Our Support Engineers first check the Mail server status.
For instance, for the Postfix mail server, we use the command:
service postfix status
If the status is found improper, we restart it using the command:
service postix restart
Most often this fixes the error.
3. Settings in the CSF firewall
In another instance, our customer using the LAMP server got the error while sending mail via Roundcube. When we checked the reason, we found that the error was with the CSF firewall setting.
So, we edited the CSF configuration. In Linux systems, the CSF configuration file is at /etc/csf/csf.conf. We replace the values of SMTP parameters as follows:
SMTP_BLOCK = 1 SMTP_ALLOWLOCAL = 1
Finally, we restarted the CSF service. That fixed the error and mail started sending from the mail client.
4. SMTP port block
Similarly, an incorrect SMTP port setting in the Mail client configuration file also causes SMTP error -1.
For instance, for mail client Roundcube, we open the file wamp/roundcubemail/config/defaults.inc.php.
And we modify the line,
$config['smtp_port'] = 465;
Here server uses 465 as the SMTP port. Later we restart the service and this resolves the error.
[Having trouble in fixing SMTP errors? – We are available 24/7.]
In short, SMTP error -1 indicates that the connection to the server failed. This is because of many reasons like TLS certificate expiry, errors with the mail server or mail clients, SMTP port block, firewall restrictions and so on. Today, we saw how our Support Engineers fix this error.