I have been having trouble receiving email from Gmail via IMAP today. The Google Apps status dashboard does not reveal anything is wrong, so lets go spelunking!
openssl to make the connection to transparently handle the TLS connection:
$ openssl s_client -crlf -connect imap.gmail.com:993 * OK Gimap ready for requests from 126.96.36.199 zh1mb199258645pbc
We have a connection! The
-crlf is critical for Gmail as the line endings are important to the "Gimap" server (and the protocol in general, but other servers I have tested are more accepting). If you weren't using encryption, you would
nc imap.gmail.com 143 instead of using OpenSSL.
Lets poke the server a little.