which id should we use to get ultimate unique id of message?
or MessageID is like
but only if message was received
UniqueID is like
is that really unique?
or a combination of them?
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.
Welcome to Q&A forum for C# and VB.NET developers working with following .NET components:
If you need immediate assistance, please contact us directly.