How to talk to IMAP server in Shell via OpenSSL

Denis Kutlubaev picture Denis Kutlubaev · Feb 19, 2013 · Viewed 65.6k times · Source

I want to send IMAP commands via Mac OS X Terminal to server and get response. I can connect to the server using this line:

openssl s_client -connect imap.gmail.com:993

And I can successfully login:

? LOGIN m.client2 passwordhere

But all other commands do not work, no response from server. I tried for instance this:

? LIST "" "*"
? SELECT INBOX

Answer

Denis Kutlubaev picture Denis Kutlubaev · Feb 19, 2013

Found an error by help of a friend:

openssl s_client -connect imap.gmail.com:993 -crlf

-crlf is critical