What are the headers of the Internet Message Access Protocol?

Running Wireshark while I retrieve my emails with Outlook & IMAP, would give me the headers of IMAP, right?

Can I also see the headers when I login to an IMAP server using telnet?

up vote 5 down vote accepted

IMAP doesn't have "headers", in the way that I think you're thinking of them. It has commands and command responses. E-mail headers are a part of the message itself, which IMAP can give you access to. Those are the headers that are most useful in terms of tracking down where an e-mail came from and reporting it for abuse. When people talk about e-mail headers, they typically mean the e-mail message headers (RFC-822/RFC-2822 headers) and not "IMAP headers".

In other words, IMAP can access the e-mail headers, but they aren't specifically IMAP headers.

As far as using wireshark to view the headers, this is likely to be complicated by SSL or TLS. You may have to disable SSL or TLS to be able to view these connections. Depending on the server configuration, you may not be able to even login to the mail server with SSL/TLS disabled.

If you control the server and the SSL/TLS certificate, wireshark can import the certificate key file, and decrypt the packets.

As Wil says, the IMAP command-set is rather large and complicated.

Telnet is not about seeing the headers, it is about making a direct socket connection and inputting data. If you can see or not depends entirely on the remote server and how it is set up.

As for Wireshark, unless you are connected to a SSL Server (or act as a man in the middle) you should be able to see the entire session fine.

You can read the official IMAP Specification here. As for commands to type, there is a lot - unlike SMTP to send messages, it is a lot more complicated. I recommend reading this, it gives a lot of information that can help you.

  • I would add to this that imap is not a packet-oriented protocol (where you typically see per-packet headers), but instead a stream-oriented protocol. As such there aren't any headers as you (and wireshark) typically think of them. – Slartibartfast Dec 4 '10 at 22:47
  • What are the headers then? Turns out outlook always uses SSL, so I had to open a telnet connection to even see the IMAP Data in Wireshark. – kjurrt Dec 5 '10 at 0:55
  • Does IMAP even have real headers?! As Slartibartfast said, IMAP is stream-oriented and does have states. – kjurrt Dec 5 '10 at 1:11
  • Sorry, in the context of your message, I gave my answer - ... No "headers" as such. – William Hilsum Dec 5 '10 at 13:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.