Mail showing incorrect number of flagged emails

As you can see from the screenshot, Mail has a problem with flagging emails. All emails in here were once flagged, but now only two of them actually are. Yet these emails persist in showing. Sometimes the total count is different to either number.

enter image description here

I have tried the basics: quit Mail, restarted my Mac. Any thoughts?

macOS 10.15.2


• Quit Mail if it’s open.

• In ~/Library/Mail/V7/MailData, delete any file that begins with “Envelope Index,” such as Envelope Index or Envelope Index-shm.

• Your home Library folder is hidden by default. To display it, choose Finder > “Go to Folder” and then enter “~/Library

• Open Mail.

• Mail creates new Envelope Index files. This process may take a few minutes, depending on how many messages Mail is reindexing.

• It will fix your issue.

"Message Import": Message Import


Two things to try:

  • Find out which account they belong to, select it in the sidebar and rebuild the mailbox using Mailbox Menu. You would temporarily lose all attachments, and they'll be downloaded again.

  • If all the flagged emails have one color, select them all, and assign them a new flag.