OS X Mail.app: Old mail not downloading/showing after reconfiguring exchange account Context: Mail.app in OS X 10.7.5, connecting to MS Exchange Server 2007.

For whatever reason, my company has two domains where I can access the Exchange server. I was using one of them, but for some reason address book sync was broken.

I closed Mail.app, Addressbook.app and iCal.app, deleted the old account, and created a new one that used the other domain. This fixed syncing the address book.

Unfortunately, while my calendar came back safe and sound, the same can't be said for the mail account. All my new mail is arriving fine, all the folders are shown, but old mail is not being shown in the message list pane for any of the folders. Clicking "Get new messages for all accounts" button does nothing whatsoever.

However, if I open the Account Info dialog from the context menu of one of the folders, it does show the correct message count and size. The messages are also available on the IMAP bridge that Thunderbird is using on another machine, and on webmail. So they are clearly still there.

Why would Mail.app not download/show the old messages, and how do I fix that?
The 'find the answer to your question 5 minutes after asking it' syndrome strikes again: using the Mailbox menu's Rebuild command fixes the issue. You can select all the folders for which this needs to happen before using the menu item to save yourself some time (but beware that all this syncing might take a long time if you've got a big mailbox).