How to Fix SMTP Error (-1): Connection to Server Failed

When we tried to send an email from cPanel, we got an error “SMTP Error (-1): Connection to server failed”. We can fix this issue by simply following the below steps.


Method 1

First, we need to check the status of the exim service in the server and make sure the exim is running.

# service exim status

If the exim status is active, then you can follow Method 2. Else you got an error shown below, then please follow the below command.

# service exim status

exim dead but subsys locked

If you see this error search the file /etc/eximdisable. If you found the file, then do the following steps.

# mv eximdisable eximdisable.bak

# service exim restart


Method 2

If the Exim status is okay, then please follow the below steps.

1) You need to edit the CSF firewall with the following code. open CSF file

# vi /etc/csf/csf.conf

most probably the issue was with the following code.



You would need to change SMTP_ALLOWLOCAL to 1 to enable Webmail to function.


2) Last restart csf using the following command to enable all changes.

# csf -r


You can also edit the CSF configuration file using WHM.

1) Login to WHM.

2) Navigate to “ConfigServer Security & Firewall” under “Plugins” section.


3) Edit the configuration file by clicking “Firewall Configuration” in “ConfigServer Security & Firewall”.


Then change “SMTP_ALLOWLOCAL ” off to On.

4) Finally, you need to click on “Change” button to enable the changes and restart csf.


Method 3

The above fixes don’t work, please try the below fix. Here we are trying to rebuild the exim.

# mv /etc/exim.conf /etc/exim.conf_bak



/scripts/eximup –force

/etc/init.d/exim restart


Now this will fix the error.


If you need any further help please do reach our support department.