A good quick article on how to manually log into an IMAP Server using SSL is at:
http://www.jaharmi.com/2007/09/26/using_openssl_securely_connect_your_imap_account
The important part is:
As an example, here’s how you could log into an Exchange account, select the “Inbox” folder, and log out:
$ openssl s_client -connect server:port -crlf
? LOGIN username password
? SELECT Inbox
? LOGOUT