
Testing IMAP via Telnet
Test the IMAP email protocol over a simple Telnet connection.
1 min read
The challenge when testing IMAP is that the protocol supports multiple concurrent connections.
Therefore, every command must be prefixed with a “tag”. This “tag” only serves to tell apart the responses of several concurrent connections. When testing via Telnet, a “.” is perfectly sufficient as a “tag”.
telnet mail.server.com 143
* OK IMAP4rev1 server ready at MM/DD/YY hh:mm:ss
. login <UserName> <Password> # Log in with a username/password combination
. OK User logged in
. list "" "*" # List all mailboxes incl. subfolders
* LIST (\HasChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "INBOX.Drafts"
* LIST (\HasNoChildren) "." "INBOX.Sent Items"
* LIST (\HasNoChildren) "." "INBOX.Trash"
. OK Completed (0.460 secs 5 calls)
. status INBOX (messages) # Get the number of messages in the inbox
* STATUS INBOX (MESSAGES 2)
. OK Completed
. status INBOX (recent) # Get the number of new messages in the inbox
* STATUS INBOX (RECENT 0)
. OK Completed
. status INBOX (unseen) # Get the number of unread messages in the inbox
* STATUS INBOX (UNSEEN 0)
. OK Completed
. logout # log out
* BYE LOGOUT received
. OK Completed