+2 votes
by (990 points)
edited

which id should we use to get ultimate unique id of message?

sequence number

or MessageID is like <4D4AB68A.3060909@arcor.de> but only if message was received

UniqueID is like Ez0+2gAAAA7 is that really unique?

or a combination of them?

Applies to: Rebex Secure Mail

1 Answer

+3 votes
by (147k points)
edited
 
Best answer
  • MessageID is an ID that is supposed to be generated by the sender (it is used to make it possible to easily associate replies with the original message). But many simple mail sending scripts don't generate it. In that case, some mail servers add some MessageID themselves. In any case, there is often no guarantee that it will really be unique.

  • UniqueID in Rebex POP3 is a unique ID assigned by the POP3 server when the message is received, and it's safe to assume it is really unique.

  • UniqueID in Rebex IMAP is Base64-encoded concatenation of IMAP's "UID" and "validity" values (the original values can be parsed using ImapMessageSet.ParseUniqueId method). The UID is assigned by the IMAP server when the message arrives and the combination of UID and validity is guaranteed to be unique in a single IMAP folder. (The server is permitted to change the validity, which invalidates all UIDs, but this doesn't occur very often on the majority of IMAP servers.)

I'm afraid the answer to your question depends on what you mean by "ultimate". If you only need a unique ID for a database, I would prefer generating a GUID to using unique ID or message ID values provided by third-party mail agents or mail servers.

...