imap is inbound and smtp is outbound krnkris
To troubleshoot http, https, smtp, pop3, imap etc service connectivity, first identify the port that the tcp service runs, then confirm that the port is open. So for example
frappe@erpnext:~/frappe-bench$ nc -vv smtp.gmail.com 587
Connection to smtp.gmail.com 587 port [tcp/submission] succeeded!
220 smtp.gmail.com ESMTP l22sm30607654pfi.2 - gsmtp
frappe@erpnext:~/frappe-bench$ nc -vv imap.gmail.com 993
Connection to imap.gmail.com 993 port [tcp/imaps] succeeded!
You will find more checks here