Have you come across a issue where you are trying to send email from cPanel and you get error as "SMTP Error (-1): Connection to server failed." Here is what you can do to fix it.. There are 2 analysis/fix that I have found.
Fix 1: At first, check the status of the exim service on the server and check if exim is running, and if it does, then the issue is different, so you can then follow what is mentioned in the "Fix 2."
If you get error here, like "exim dead but subsys locked", then do as given below:
Search for file /etc/eximdisable. If it does exist, then rename it using below command:
After that restart the exim service using below command:
Fix 2: If the Exim status is okay, then please follow the below steps.
Edit the CSF firewall using below command:
Check for below 2 codes in the configuration file.
Change the SMTP_ALLOWLOCAL to 1, so this will enable webmail to function properly.
Now, restart the firewall configuration using below command.
If you are not familiar with the commands, then her is the method to update it from WHM interface..
Login to the WHM >> ConfigServer Security & Firewall.
Edit the configuration file by clicking "Firewall Configuration" in "ConfigServer Security & Firewall" section.
Change "SMTP_ALLOWLOCAL" Off to On.
Click on "Change" button to enable the changes and restart csf.
This will fix the issue..
Fix 1: At first, check the status of the exim service on the server and check if exim is running, and if it does, then the issue is different, so you can then follow what is mentioned in the "Fix 2."
# service exim status
# service exim status
exim dead but subsys locked
exim dead but subsys locked
# mv eximdisable eximdisable.bak
# service exim restart
Edit the CSF firewall using below command:
# vi /etc/csf/csf.conf
SMTP_BLOCK = 1
SMTP_ALLOWLOCAL = 0
SMTP_ALLOWLOCAL = 0
Now, restart the firewall configuration using below command.
# csf -r
Login to the WHM >> ConfigServer Security & Firewall.
Edit the configuration file by clicking "Firewall Configuration" in "ConfigServer Security & Firewall" section.
Change "SMTP_ALLOWLOCAL" Off to On.
Click on "Change" button to enable the changes and restart csf.
This will fix the issue..