Rebuild mailboxes to fix incorrect handling of Mail messages in OS X

A simple rebuild of mailboxes can fix message handling problems.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
3 min read

Apple's Mail application in OS X offers a built-in option for managing e-mail from a number of services, including standard POP and IMAP accounts, as well as services from specific providers like Google, and Yahoo, among others. Most of the time Mail will allow you to properly interact with your messages; however, there are times when it can improperly manage messages and give you some odd behaviors.

Some of these behaviors include:

  • Deleted messages reappear -- If you remove a message from your inbox, either by deleting or moving it to a new mailbox, then it should disappear. However, it may stubbornly show up in your inbox again, sometimes after quitting and relaunching Mail, or when switching back and forth between mailboxes.
  • Message "cannot be found" errors -- When attempting to move or delete messages, you may see a warning that the message cannot be found.
  • Blank mail messages -- If you locate some messages and attempt to view them, either by clicking or double-clicking, Mail will only show you a blank message, with no content, header, or other information on it.
  • Incorrect message counts -- Mailboxes may show incorrect numbers of total messages, or incorrectly report the number of unread messages even if the total is correct.
Rebuild mailbox menu option in OS X Mail.
The Rebuild option is available at the bottom of the Mailbox menu, once you have selected at least one mailbox. Screenshot by Topher Kessler/CNET

These types of errors can be frustrating to deal with, especially since once they start, they sometimes get worse.

Sometimes, a problem can occur because of the way Mail manages your message organization. In order to speed up message handling, the messages in each mailbox are indexed, and it is this index that is accessed for the number of messages in the mailbox, and not the messages directly. The index lets Mail know what specific files are to be read and opened when you select messages, and it also contains unread file counts and other information which is displayed as you manage your e-mail.

If the mailbox index is damaged, then Mail may show incorrect statistics and other data from it, and also be unable to properly access and handle the messages referenced by the damaged index. Therefore, if those listed above or similar errors are happening to your mailboxes, you can likely correct them by rebuilding your mailbox index.

To rebuild the index, select your desired mailboxes by holding the Shift or Command keys and clicking them to add them to the selection, and then choose "Rebuild" from the bottom of the Mailbox menu. This will clear the current index for the selected mailboxes and then read through your messages to rebuild it, so it may take some time, but when complete, it should give accurate information about the messages in the mailbox.

While rebuilding the mailbox may not always be needed, it can help fix problems you may not even be aware of yet. Consider periodically running a mailbox rebuild even if you do not see any problems, since this will ensure messages in your mailbox are properly represented in the program.

Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.