IMAP Sessions

So, what does a full IMAP session actually look like? After all of the detail shown earlier in this chapter, one might easily be confused, but it is not that bad when put in context. Although the protocol is much more complex than POP, a review of the example session shown will probably give you the flavor of it.

An example session is shown in Figure 11-2. A client initiates an IMAP session to a server, which responds with a banner greeting. The client is now in the Nonauthenticated State since no authentication credentials have been presented.

Since the client is allowed to issue a CAPABILITY command in any state, we show that here. The server’s response shows that it is indeed an IMAP server handling IMAP Version 4 Revision 1. It also shows that the server supports an additional authentication mechanism (shown with the “AUTH=” part of the response) that accepts X.509 digital certificates.

The client logs into the server with basic username/password authentication using the LOGIN command, a username of “mmouse”, and a password of “mickey”. Once the server accepts the credentials, the session is placed in the Authenticated State.

In the Authenticated State, the client issues a LIST command to see available mailboxes. Only two mailboxes are returned from the server in this example: one named “~/Mail/Inbox” and the other named “~/Mail/Stuff”. The server response shows that the first mailbox is marked as “interesting” by the server, probably meaning that unread messages are ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.