I’ve had this ongoing issue for some time whereby Lucee server, previously known as Railo, would not verify the mail host. I was able to connect via Telnet to the mail server from the Ubuntu server.
Turns out it was that the server didn’t have the host defined which also produced the error;
unable to resolve host
Define the hostname in the hosts file. Simple as that.