There is a quick fix if Mail in OS X does not properly report the number of unread messages in its dock icon.
When you configure Mail with one or more of these services, the program will display the number of unread messages in the Mail icon in the OS X Dock, indicating you have new messages in one or more accounts.
While this indicator should give you the number of unread messages available, sometimes it may show an incorrect count. This is because Mail relies on an index database in its mailboxes, which should be updated accordingly when new messages are downloaded from your mail servers, but sometimes are not.If your mailbox indexes are damaged, then you might experience Mail showing you available messages even though all messages are marked as read, or similar instance of mismatch between unread mail and the count in the index.
To fix this issue, you simply need to have Mail rebuild its index, which it can do from the available messages in your various inboxes. This can be done by following these steps:
When you do this, Mail will take a few minutes to read through you various messages and create a new index, which should now properly reflect the unread message count in your mailboxes.
Questions? Comments? Have a fix? Be sure to check us out on Twitter.