[MlMt] Where is message flag color information kept?

Bill Cole mmlist-20120120 at billmail.scconsult.com
Fri Jul 16 10:45:55 EDT 2021

On 2021-07-15 at 08:25:41 UTC-0400 (Thu, 15 Jul 2021 05:25:41 -0700)
Greg Earle <mailmate at lists.freron.com>
is rumored to have said:

> tl;dr: Where do MailMate/Apple Mail store the flag color info for each 
> message?

All on the server, in IMAP flags/keywords: \Flagged, $MailFlagBit0, 
$MailFlagBit1, and $MailFlagBit2

Standard IMAP flags in a Maildir mailbox are stored as a string of 
characters sorted in ASCII order (all capitals before lowercase) at the 
end of the filename, delimited by a comma. Both Courier and Dovecot use 
the capital letters DFRST for the \Draft, \Flagged, \Answered (i.e. 
Replied), \Seen, and \Deleted (i.e. Trashed) flags. The original Maildir 
spec also defines a

Courier stores arbitrary additional keywords (non-standard flags) in a 
subdirectory named courierimapkeywords with a master list of keywords 
and a file for each message that has any keywords set.

Dovecot maintains a dovecot-keywords file in each Maildir mapping any 
additional keywords to lowercase letters (perversely by numbering them 
in the file so that keyword '0' is indicated by 'a' in the filename 
tail.) If you use more than 26 unique keywords in a single mailbox in 
Dovecot, it falls back to storing the 27th and later ones in its binary 
index files in the Maildir.

So to convert a Courier Maildir to a Dovecot Maildir while preserving 
flags, you would need to do more than rsync them. You would also need 
something that translates the contents of courierimapkeywords into 
additional characters at the end of message files and a dovecot-keywords 

Bill Cole
bill at scconsult.com or billcole at apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire

More information about the mailmate mailing list