There are cases when you want to check a mailbox, simply, do credentials are valid, how many folders does a mailbox have. And mailbox’s server exposes IMAP protocol to communicate with. You can use Outlook, Thunderbird, etc. But sometimes you do not want to install them, configure them, add another mailbox, because you need only a quick check and forget the mailbox forever. Moreover if you diagnose an error these clients may not give you a helpful raw error information.
And you do not need them when you have cmd and telnet. To use IMAP via telnet you just need to know IMAP commands and be aware of some tips which are not so explicit and may make a little pain.
The first tip
Note: it is applied to OK Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7638.1. I am not aware about another implementations of IMAP servers
You have to use such format with your IMAP commands: <tag><one-whitespace><command>[arguments] Example:
tag LOGIN name password tag OK LOGIN completed.
If you do not use both a tag and a whitespace, IMAP assumes your command to be tag and the next word is assumed as a command:
SELECT INBOX SELECT BAD Protocol Error: "Unidentifiable command specified".
SELECT is a tag, and INBOX is a command in the example above.
If you do not use a tag but use a white space, IMAP assumes you have missed the tag
SELECT INBOX * BAD Protocol Error: "Tag not found in command".
SELECT is a command, the tag is undefined.
If you use more than one whitespace between a tag and a command, the IMAP could not parse the command and responds with the error below:
t SELECT INBOX t BAD Protocol Error: "Unknown command found".
t is a tag. The second white space starts a command.
The second tip
When you work with an IMAP session via telnet, what you see is not what you get (WYSINWYG). For example, you can type a command name and mistyped occasionally. What do you do? Of course, you move back a cursor and overwrite incorrect letters (the backspace is not working). But all your input (both overwritten and new characters) is buffered and send when you press [Enter]. Be aware of this, it is really painful.
When does telnet help?
There were two situations when using IMAP via telnet I diagnosed two problems with mailboxes.
The first one, when an account was locked. Outlook asked me password all times and was silent, on other hand an IMAP session responds to me that the account is really locked out.
The second one when someone transferred the mailbox from one server to another. I suppose they were in a sort of server garden. Outlook just showed empty content of the mailbox. While telnet said that “There is no replica for that mailbox on this server.” when I was trying to select its inbox.