Accessing Maildir locally with Mutt and remotely over IMAP simultaneously

dovecotimapmaildirmuttpostfix

I have Postfix + Maildir + Dovecot + IMAP on my mailserver. I am accessing my mailbox remotely over IMAP with one or more clients (Thunderbird). Additionally, on the server I have mutt configured for local (Maildir) access.

When I am connected over IMAP with Thunderbird, and simultaneously start mutt locally on the server, Mutt seems to be confused. When I move a message in Thunderbird (over IMAP), Mutt notices something has changed and reports:

Mailbox was externally modified.  Flags may be wrong

The problem seems to be one-sided. When I manipulate a message in Mutt, Thunderbird registers the change and has no problem with it.

Thus my question:

How can I make remote IMAP client and local Mutt client acccess Maildir without any conflicts/data corruption/errors?

Important:

I am looking for a solution where the Mutt access is local. For reasons beyond this discussion, I don't want Mutt to access the Maildir over IMAP.

Sidenote:

I don't understand why Mutt complains that mailbox was externally modified. After all, Postfix also modifies the mailbox when it delivers new emails.

Best Answer

Maildir store some data in the message filename. That data include message ID, sizes (with and w/o newlines) and flags. When unread message is opened, it is moved from new to cur and its name changes from

1406379300.M375059P35208.R93M.lan,S=679,W=699

to

1406379300.M375059P35208.R93M.lan,S=679,W=699:2,S

IMAP server can track that changes cause it use maildir's index file to access certain message. When mutt access messages directly from filesystem collisions are unavoidable.

Related Question