Use these commands with telnet to test an IMAP server:
telnet server 143 01 LOGIN <user> <pass> 02 LIST "" * 03 SELECT INBOX
You have to write the two digits before each command. You can see all the mailboxes with line 02.
Note : You can use netcat instead of telnet.