ERROR:

Message not sent. Server replied:
Connection refused
111 Can't open SMTP stream.

Solutions
Horde works.
Custom install of SquirrelMail works.
Cpanel version of SquirrelMail does not work.

------

Usually servers with CSF seems to be getting this error

1) Enabling the SMTP tweak in WHM, which mayy break the csf can fix sometimes.
(It is likely related to an iptables rule used to deny connections from those other than exim, mailman and root. Turning the SMTP Tweak on and then off should recreate this rule correctly.)

2) config for Squirrelmail:
/usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

I just changed:
$useSendmail = false;

to:
$useSendmail = true;


This will probably get written over with the next cpanel update, but can send mail again for now.

3) Editing the CSF conf
# Block outgoing SMTP except for root, exim and mailman (forces scripts/users
# to use the exim/sendmail binary instead of sockets access). This replaces the
# protection as WHM > Tweak Settings > SMTP Tweaks. This will block hosting
# clients from using your server as an SMTP relay

SMTP_BLOCK = 1

# If SMTP_BLOCK is enabled but you want to allow local connections to port 25
# on the server (e.g. for web scripts) then enable this option too

SMTP_ALLOWLOCAL = 1

I originally had SMTP_ALLOWLOCAL = 0 and SMTP_BLOCK set to 1.

The notes in the config make mention of local script access.

Out of the 3 , one will work for sure.

This can work with SquirrelMail's conf set to useSendmail = false;