MacOS – 10.9 Mail “smart mailbox” doesn’t filter properly

gmailmacosmail.app

I have a smart mailbox setup to combine the inboxes of my 3 Gmail accounts. It worked great in 10.8. In Mavericks, this "smart inbox" frequently shows messages which have already been archived, and do not appear in the regular Gmail inbox within Mail.app. This screenshot shows an example. So Mail recognizes that the two messages are archived, yet they still show up here. These two messages do no appear in the regular Gmail inbox within Mail.

I have already tried deleting and recreating the smart mailbox. I show its settings below.

enter image description here

enter image description here

Best Answer

Here are two more possible solutions.

Reset Permissions

chmod -a 'everyone deny write,delete,append,writeattr,writeextattr,chown' ~/Library/Mobile\ Documents/com~apple~mail/Data/MailData/* ~/Library/Mobile\ Documents/com~apple~mail/Data/MailData/Signatures/*

This resets permissions on email related items (you can reset permissions on everything in Disk Utility).

Remove Indexes

rm -rf ~/Library/Mail/V2/MailData/Envelope*
mdimport ~/Library/Mail

This second possibility gets rid of Mail's index (Mail will rebuild it upon restart) and refreshes Spotlight with your email content.