GICT knowledge base
How to Fix SMTP Error (-1): Connection to Server Failed
Published
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.
SMTP_BLOCK = 1
SMTP_ALLOWLOCAL = 0
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/rebuildeximbsd
/scripts/eximconfgen
/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.
Related guides
How to Restrict an SSH Key to One Command
Restrict an SSH key to one command with authorized_keys options. Protect the command and check that unwanted shell and forwarding access are denied.
Linux and CommandsSelf-Hosted Video Processing With FFmpeg: A Practical Guide
Learn how to self-host video processing on a VPS using FFmpeg, with practical commands for conversion, compression, thumbnails, and automated workflows.
Linux and CommandsHow to use nohup: Commands in Linux That Survive Terminal Closes
Keep commands running after you close the terminal. nohup examples with wget, Python, rsync, and Docker on any VPS.
Linux and CommandsHow to Fix “Too Many Open Files” Error on Linux Servers
Learn how to fix the "Too Many Open Files" error on Linux servers by understanding file descriptors, adjusting limits, and diagnosing leaks effectively.


