SMTP server telnet connection refused on Linux?

I was testing the WP Mail SMTP plugin to send emails in WordPress via SMTP servers but when it was trying to connect to the remote SMTP server, it kept getting error “Connection refused”.

So I tried:

telnet smtp.xxxx.com 587

To test the connection. Turned out my own server is preventing the outgoing request because of the permission denied error by CSF as I didn’t have enough privilege as an ordinary user of the server:

grep -i smtp_block /path/to/csf.conf

grep: /path/to/csf.conf: Permission denied

Needless to say, the telnet connection successfully went through to the remote SMTP server when I logged in as root.

So the solution is simple. Just add the user to /path/to/csf.conf for SMTP privilege:

SMTP_ALLOWGROUP = "mail,mailman,youruser"

That’s it. Now youruser is capable of connecting to remote SMTP servers.

Scroll to Top