Question:
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.
Case in point: new client had actually abandoned her mailbox in her own domain because the mailbox contains 70,000 emails, the vast majority of which are junk. Does anybody know of a tool or site which can clean up such a mailbox, or at least make a good first attempt before manual cleanup? How to clean up Mac with CleanMyMac 3: Download and install CleanMyMac 3 on your Mac. Launch the program. Go to the Large and Old Files section on the menu. Review the details, select what to clean and then click Clean.
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?
Answer:
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 and later (at least through Yosemite) it’s ~/Library/Mail/V2/MailData. Inside both of these folders are files that start with “Envelope Index” that store all your mailbox data, among other things.
Quit Mail, then delete all the files in this folder that start with 'Envelope Index.' On Yosemite that will be three (3) files (Envelope Index, Envelope Index-shm, and Envelope Index-wal); on older versions of OS X it may be simply one file. Once deleted, relaunch Mail and the file(s) 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 through Yosemite (and possibly future OS's), it’s:
For Snow Leopard, the command is:
Remember, you should only have to perform one of these methods, not both. That should solve your problem and rebuild all of your mailboxes.