Had a problem earlier this week, webmail couldn’t always send e-mail.  It was coming back with the following error:

SMTP Error: SMTP error: Connection failed: Failed to connect socket: Connection timed out.

After reading a few things  I turned on the SMTP tweak..  things appeared to work for a few hours, then it started failing again.

Searching online said to trying telnet on the command line – so did that, connected to port 25 – all fine… hmm odd – tried webmail again – failed…..

After a more indepth search I found a forum which gave me a hint – apparently other people have had the same problem when using the firewall for cpanel – CSF.  CSF is definately one of the best firewalls around for linux and works really well with Cpanel – however every now and again the amount of options can cause you to miss out something obvious:

# If SMTP_BLOCK is enabled but you want to allow local connections to port 25
# on the server (e.g. for webmail or web scripts) then enable this option to
# allow outgoing SMTP connections to 127.0.0.1
SMTP_ALLOWLOCAL = 0

The SMTP_ALLOWLOCAL set to 0 stops webmail etc… not sure when this appeared (the server has been working fine for about 4 months) but change it to 1 – restart CSF and there we go it’s working fine 🙂