To test an IMAP server using Telnet (expected server responses in italics):
telnet imap.example.com 143
* OK imap.example.com IMAP4rev1 v12.202 server ready
0 login username password
0 OK [capabilities list] logged in
0 logout
* BYE logging out
If you receive the expected responses you have confirmed the IMAP server is functioning and accepting your account authentication.