Here is how you can do a basic test of an IMAP server via telnet:

telnet IMAP Server Name 143
? LOGIN username password
? LIST “” “*”

This will log you in and list the accounts mail folders. Note: This is testing a basic unencrypted login to an IMAP server. Not the way you would want to implement in production, unless implement via localhost.