Many common problems with Mail can be fixed by rebuilding all or part of its index database. For example:
First, try a quick rebuild. Select the problem mailbox, go to the Mailbox menu, and choose Rebuild.
If this doesn’t solve the problem, try a complete rebuild:
Quit Mail.
Locate the Envelope Index file:
On macOS 10.12, the file is stored at:
/Users/<username>/Library/Mail/V4/MailData/Envelope Index
See the How can I open the Library folder? section. Then open the Mail folder, then V4, then MailData to find the Envelope Index file.
Make sure that you also delete Envelope Index-shm and Envelope Index-wal (if they exist).
On Mac OS X 10.11, the file is stored at:
/Users/<username>/Library/Mail/V3/MailData/Envelope Index
See the How can I open the Library folder? section. Then open the Mail folder, then V3, then MailData to find the Envelope Index file.
Make sure that you also delete Envelope Index-shm and Envelope Index-wal (if they exist).
On Mac OS X 10.7 through 10.10, the file is stored at:
/Users/<username>/Library/Mail/V2/MailData/Envelope Index
See the How can I open the Library folder? section. Then open the Mail folder, then V2, then MailData to find the Envelope Index file.
Make sure that you also delete Envelope Index-shm and Envelope Index-wal (if they exist).
On Mac OS X 10.6, the file is stored at:
/Users/<username>/Library/Mail/Envelope Index
See the How can I open the Library folder? section. Then open the Mail folder to find the Envelope Index file.
Once you’ve found the file, drag it to the trash.
Note: Rebuilding the index database is perfectly safe. Even though it seems that you are deleting a file, Mail stores its primary copy of your message data elsewhere. When you delete the damaged database, Mail uses this primary copy to create a new index database.
Relaunch Mail. It will welcome you as if you haven’t used it before. This step may take a few minutes, as Mail searches through all of your stored messages to build your new database file. IMAP and Exchange messages will need to be re-downloaded from the server.