FreeBSDwiki:IMAP, testing via Telnet

From Ubuntuwiki.net

Jump to: navigation, search

When troubleshooting an IMAP service, it's frequently helpful to use the telnet client to "speak" to the server directly, rather than using a mail client which won't give you the exact responses the server does. In this example, we will use telnet to connect to an IMAP server, log in as a user, list the user's available mailboxes, and check messages in one of them.

ph34r# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
* OK dovecot ready.
A LOGIN postmaster@mail.getsdeliveredhere.net thisismypassword
A OK logged in.
A LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX"
* LIST (\HasChildren) "." "Sent"
* LIST (\HasNoChildren) "." "Sent.2006"
* LIST (\HasNoChildren) "." "Sent.2007"
a OK List completed.
A SELECT inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 1 EXISTS
* 1 RECENT
* OK [UIDVALIDITY 1103088195] UIDs valid
* OK [UIDNEXT 1] Predicted next UID
A OK [READ-WRITE] Select completed.
A LOGOUT
* BYE Logging out
A OK Logout completed.
Connection closed by foreign host.

Okay - we've just verified on a very direct level that the IMAP server we connected to answers incoming connections, successfully authenticates users, and successfully opens their inboxes - see the * 1 EXISTS and * 1 RECENT lines? That tells us that there is a single email in the inbox folder, and it hasn't been read yet. (We got "inbox" from the results of our LIST "" "*" command, which asked for a complete list of folders on this account.)

See Also

Daemons, testing via Telnet

SMTP, testing via Telnet

POP3, testing via Telnet

HTTP, testing via Telnet

Personal tools