I'm getting connection refused or connection timed out error in debug log. What should I check?
Try to reach the mail server via the console (CLI).
For example, try to ping or use telnet smtp.hostname.com:port directly from your server where Magento is hosted (not PC) and check the response in the command line. If it fails to reach the mail server, the connection is blocked and you'll see 'connection timed out' error message.
Alternatively, you may contact your hosting provider to make sure that outbound connection to the specified port is not blocked from their side.