Mail.app and IMAP Folders
For some time, I've been annoyed by Mail.app not checking all folders every time it checks mail. My situation is that I have an IMAP server at a colo, a Mac Pro at home usually with Mail.app running and more importantly, running its filters, and a MacBook running Mail.app that I take with me to work or wherever.
The problem is that as mail comes in and gets filtered by the Pro, the laptop continues to check mail every minute. However it does not "see" messages that get filtered off. So if Dave sends me mail and it goes to the Dave folder, the only way I notice it is if I manually click that folder, which isn't happening.
So how do you fix it? I know there is probably a way, but I've not found an official answer to this in the months I've been looking, so here's what I've got that actually works.
Hit the Mailbox menu and select New Smart Folder. Use "Message is not in mailbox" rules if you don't want to check things like your spam folder (I have my spam stored on the server so if something gets filtered, I see it. Also make a rule to specify "Message Type" as "Mail" so it excludes any RSS feeds you have.
This should hit every folder you have, and when it does, it will actually "touch" that folder, and make the unread message count for that folder update. So what I've done was just collapse the "Smart Mailboxes" in Mail, and I'll probably forget that thing exists, since the unread message counts are now correct.
Woo, yay Apple. My life clearly isn't complicated enough. I'll update this with screenshots later, this is kind of a draft so I remember what I did.
I had some luck using FAM (File Alteration Monitor) on the server side (Courier). Since every mail in a Maildir directory is a separate file, FAM is able to check that filesystem for changes, report that to Courier, which makes the mail clients pick up the changes. Mostly.
However, famd kept running my server out of memory, so I had to turn it off. Back to the drawing board.