Mail (Mountain Lion): Rebuild mailboxes
You might need to rebuild a mailbox to update the list of messages in the mailbox. For example, if messages appear to be missing or garbled, or if you can’t find all relevant messages when you search using Entire Message. Rebuilding a mailbox can take a while depending on how many messages are in the mailbox.
When you rebuild mailboxes for Internet Message Access Protocol (IMAP) and Exchange accounts, locally stored messages and attachments are discarded, and the messages and attachments are downloaded again from the server to your Mac. Your mailbox appears empty until the download is complete.