Concurrent Access to Mailboxes
RFC 2180 explains the issues.
What should a server do when an expunge is done by a session while another concurrent session is accessing the same mailbox?
- Keep the message around until there are no sessions that see it. This is the preferred behavior.
- Give some dummy replies for the message. Such as empty flags, and other fields being NILs or whatever is legal for the field. The downside to this is that it violates the IMAP protocol if the client had already asked something about this message.
Don't return the FETCH reply for the message at all and return a tagged NO reply. Doing this makes some clients ask the same message range over and over again infinitely. This could be avoided also: http://mailman2.u.washington.edu/pipermail/imap-protocol/2006-September/000281.html
- Disconnect the client anytime you can't handle the request. I used to do this but it was annoying when it happened.
- Don't allow EXPUNGE until there's only session. I think this is the worst of the possibilities.
The above order isn't the ideal from IMAP protocol point of view