It appears the issue with the Firewall on the server.
This problem usually occurs when CSF ( Config Server Firewall ) is installed on your server and it is interacting with the working of squirrel mail. So while configuring CSF enable both SMTP_BLOCK & SMTP_ALLOWLOCAL . Enabling just SMTP_BLOCK can cause this issue.