Joe writes: My Apple Mail mailboxes appear to have become corrupted; when I click on a mailbox in Mail, no messages appear. Following the instructions in Mail’s help files, I used the Mailbox > Rebuild command on an individual mailbox and it solved the issue.
My problem is that I have hundreds of mailboxes and it would be too time consuming to perform this step on each box individually. Is there a way to perform the rebuild command on all my mailboxes at once?
MAIL MAIL MAIL!
There are two methods to rebuild your entire mail library, including all of your mailboxes. The first is to navigate to a folder in your user directory. In Snow Leopard, this folder is ~/Library/Mail and in Lion it’s ~/Library/Mail/V2/MailData. Inside both of these folders is a file called “Envelope Index” that stores all your mailbox data, among other things.
Quit Mail, then delete this file. Once deleted, relaunch Mail and the file will be rebuilt, along with your mailboxes.
The second method involves using Terminal. Open up Terminal and type the following command using the correct path for your operating system. For Lion, it’s:
sqlite3 ~/Library/Mail/V2/MailData/Envelope\ Index vacuum
For Snow Leopard, the command is:
sqlite3 ~/Library/Mail/Envelope\ Index vacuum
Remember, you should only have to perform one of these methods, not both. That should solve your problem and rebuild all of your mailboxes.