+2 votes

For more understanding, Let's take one example.

if any message has UID 111 and other message in different folder has also UID 111 as it is possible to have same UID in different folder according to below link.

https://www.limilabs.com/blog/unique-id-in-imap-protocol

now how MarkMessageSeenByUID will work in this case? As it is not taking any folder name as argument, it has UID as argument. So in this case it will mark both messages as read?

by

1 Answer

+1 vote

The answer is simple: most IMAP client commands work in a context of currently selected folder:

client.SelectInbox();
client.MarkMessageSeenByUID(111);


client.Select("INBOX/Folder1");
client.MarkMessageSeenByUID(111);

In other words: you always select folder first.

by (297k points)
That means in one folder UID is always unique right? we can take folder name + UID as a unique key in our application?
At on particular moment in time - yes, otherwise - no.

Imagine a folder that was deleted and then new one was created, with the same name, but with a different set of messages.

folder name + folder UIDVALIDITY + UID are guaranteed to be always unique.
Thanks. Understood.
...