From time to time I have to do some troubleshooting for the IMAP4 protocol on our Exchange infrastructure. Most of the clients are running Thunderbird. For this purpose you can do two things.

    • Start Thunderbird in debugging mode

As described in this wiki article, create a batch with the following content:

This will generate imap.log on your desktop, which you can monitor while Thunderbird is talking to the mail server.

    • Connect to IMAP on command line

You will need a linux box or have cygwin installed to do this. IMAP4 is listening on port 143.

You will see the certificate exchange passing by, and you will have a blinking cursor. From here you can do IMAP console commands, as described here or here, and elsewhere 🙂
For example, to log in as user123 with password foobar, do this: (important: do not mistype, you cannot backspace and correct!)

Server’s response, in case credentials are correct, will be

You can now let the server show you all available folders:

Server’s reply, as an example:

So, INBOX has 8 subfolders. Select one of the folders.

Server’s reply, with some details about the folder:

Let’s fetch one of the emails:

This will give you the whole of the first email, including headers, ending with

You’ve seen enough, so log out:

Server’s last words (for now 🙂