Mail bug

Here’s another weird one…I’m convinced it’s a bug introduced by a recent update to Big Sur but wondered if anybody else has seen it…or possibly if I’m just missing something.

I have a total of 3 mail accounts attached to Mail and if I click the All Inboxes up under Favorites there’s a total of 50 messages of which 5 are indicated as Unread…and scrolling through verifies this 5 Unread number.

I also have a Smart Mailbox that is set for all of the following conditions with 2 conditions…message is Unread and message is in All Inboxes, with the Messages from Sent and Messages from Trash unchecked. The number of unread messages in the left column next to the Smart Mailbox says 25…despite the fact that clicking on the Smart Mailbox shows a total of…you guessed it…5 messages in the right pane, but up at the top in the toolbar it says 6 messages, 26 unread.

Recreating the Smart Mailbox has no effect.

I have 2 other Smart Mailboxes…one of which has the correct number of unread messages and the second of which shows 10 unread.

Message filtering is disabled in the All Inboxes under favorites and obviously not available under the Smart Mailboxes.

Checking the web pages for the 3 mail accounts shows a total of 5 unread between the 3 inboxes, just as displayed under All Inboxes.

I tried creating a similar Unread Smart Mailbox on my wife’s M1 MBA (also up to date Big Sur) and that one displays the correct number of unread messages. I also logged into a different (admin instead of regular) account on my MBP and connected the 3 mail accounts and recreated the Smart Mailbox and in that account the Smart Mailbox shows the right number of unread…so it’s clearly a problem just with my account. Perhaps deleting the mail accounts and re-adding them, but I suppose that making sure I have a full copy of ~/Library/Mail before I do that would be a good idea.?

It’s only a cosmetic bug…and I’m likely to get myself a new laptop after tomorrow’s announcements…maybe it’s time to consider creating the user account from scratch on the new machine rather than migrating it…but with a home directory that’s 233 GB the amount of reconfiguration and whatnot required throughout the system if I do that makes it not a very attractive alternative for what is basically a cosmetic bug.


Should have edited the first sentence…senior moment I guess. Not a bug since it works fine on wife’s MBA and a different account on mine.

I did Mailbox Rebuild…no change…and recall there used to be an envelope or index rebuild terminal command but it is no longer…I think. After a bit more thought…it’s probably a corrupted index file somewhere, but I’m not what to delete. The problematic account is IMAP so removing and re-adding it might do the trick as well.



Not the best help but my experience with my smart mailboxes is that it tied far more to the built in search engine than the mailbox. I had to fix the search engine. The search engine always failed impacting the smart mailboxes when I did fast user switching. Go figure.

Thanks Earl…I tried removing and re-adding the boot drive from Spotlight indexing…that didn’t help but I did some googling with various combinations of macOS, Big Sur, envelope, and index and ran across a support page at SpamSieve which I own, use and recommend…it suggested trying the Rebuild command in mail and if that failed then (after making sure appropriate backup exists) deleting the Envelope Index files in ~/Library/Mail/V8 along with some info on the locations. I did this and relaunched Mail…it took awhile to rebuild the indexes and then redownload all the IMAP mail. At that point the Smart Mailbox showed zero unread instead of the 33 that actually existed in All Inboxes so I deleted and recreated the Smart Mailbox and that appears to have resolved the problem. So…something in the envelop index database file was munged I guess.

1 Like

Hey Neil,

What happens if you quit and restart Mail?

Have you tried rebuilding the relevant mailboxes with:

Mail_Menu ⇢ Mailbox ⇢ Rebuild

(Doesn’t work on smart mailboxes – just the mailboxes they point to – at least on Mojave.)

Have you tried vacuuming Mail’s SQLite database?

Speed up · GitHub

** This script hasn’t been updated beyond High Sierra (10.13), although I’ve updated my copy for Mojave.


Hi Chris…thanks. I tried everything but the vacuuming already with no effect. Another reply suggested it might be Spotlight needed reindexing so I tried that as well. I did some more googling of various term combos and happened across a SpamSieve support page that told me where the index files were…so I deleted them and relaunched mail. That resulted in the Smart Mailbox having no messages instead of more than actual…so I rebuilt the Smart Mailbox and all appears to be well now. Something in one of the Envelope files was busted I guess.

1 Like

For me it wasn’t re-indexing the search but leaving the environment. Every time I did the fast user switch with mail running, I had to, when I switched back, log out of the account. So flag would get set somewhere and the smart mailboxes would basically fail.

Would you mind posting the link?

Ah…I don’t use user switching much and don’t leave mail running on the laptop if it’s asleep as then things tend to get out of sync with my iPad. I’ve considered installing SpamSieve on my iMac as well as the laptop since the iMac is always running for family file and printer sharing purposes but have just never gotten around to actually setting it up.


Solved the issue for me.

1 Like