IMAP email UID vs Message Sequence Number

I’ve had the chance to play around with some email code recently and it’s been fun. Here is something that I learned that I think should be easier to find for those who are getting into writing an app that handles emails via IMAP.

What is the difference between an email’s Unique Identifier (UID) and an emails’s Message Sequence Number (MSN?).

  • Unique Identifier: A unique number referencing an email that does not change over time
  • Message Sequence Number: The relative position from the first message in the mailbox

You can read more about this exciting IMAP email topic at