On 21.11.2011, at 22.02, Alexander Chekalin wrote:
> I need a way to identify message across my mail box. The idea is that I can
move messages between IMAP folders and the index still should be able to
identify it.
Message GUIDs are pretty good for that.
> What I want to know, will UID strings be unique across all my messages no
matter which IMAP folder it belongs now to, or the UID can change if I move
message? If I remove dovecot-uidlist from the folder will UIDs of messages in
the folder be changed? What happened if I put a message to the given IMAP folder
(and dovecot-uidlist will record UID for it), then shut down dovecot, and (given
maildir storage model) move the message's file info another folder in the
same mail box - after I start dovecot, will the UID for the message be the same
or not?
With Maildir the message GUID is typically the same as the Maildir base filename
(i.e. everything before ':' character). Assuming you're using
Dovecot v2.x, when mail is copied to another mailbox its filename is preserved.
So deleting dovecot* files won't lose the GUID.
The only problem is that if you copy the same mail twice to another mailbox, it
can't of course have the same filename twice, so Dovecot will assign it a
new filename. But in a new enough version (probably v2.0.something) it still
preserves the GUID by writing it to dovecot-uidlist file. In this situation if
you delete the uidlist, the GUID changes to its filename.