This project is read-only.

Unique ID for Emails

Jun 2, 2013 at 1:03 PM
Hi all,
first of all, thanks to the author for this great library. Its working great !!

To my first question: is there any possibility to identify an email with kind of unique id ? Since the MessageUid doesnt do it.


Jun 2, 2013 at 7:33 PM
Hi mzda,

Thank you for the kind words, we're trying to the library as good as possible, but it's only possible thanks to the feedback from our users.

If following the documentation, the MessageUid, which as unique identifier, never changes within one session, and should not change between sessions. Most servers will stuck to these two rules strictly, so in 98% of cases you can be sure the MessageUid can be used to identify a message.

In other cases you need three aspects to identify a message - the mailbox name, the MessageUid and the Folder.UidValidity.

For further details you can check the specification:

If you have more questions, feel free to ask.

Best regards,

Pavel Azanov
Jun 2, 2013 at 8:52 PM
Hi Pavel,
the id capability from IMAP is not usefull to me since I need to move an email from one folder to another and it still has to be recognized as the email, which I have retrieved.

So my current solution is to use the message-id from the email header, which I can read through this method:

string unique_id = mm.Headers["Message-ID"];

Since the message-id is unique for each smtp server and the domain name of the smtp server is also mentioned in the message-id, I don't see any problem with that. What do you think ?

Best regards,
Jun 2, 2013 at 10:23 PM
Edited Jun 2, 2013 at 10:23 PM
Hi Donny,

I think it's no problem to use the Message-Id header as unique identifier. But you must be sure that the server your using always returns this header field.

Another point - you don't have to access the Message ID header field value through the header collection, simply use the Message.MessageId property.

Best regards,