Mail.app mailbox corruption

Once a week or so, Mail.app will not display the contents of a mail message. Selecting Mailbox -> Rebuild fixes bandaids the issue until next time.

I only have one account in Mail.app, pointing to a Microsoft hosted Exchange server. This has happened consistently for the past 3 months.

What information would help to solve this problem, or what is a solution to this problem?


You could try deleting the "Envelope Index" files.

Run the following Terminal commands to backup and delete the files:

cd ~/Library/Mail/V2/
cp MailData MailData.old
cd MailData
rm Envelope\ Index Envelope\ Index-shm Envelope\ Index-wal

Alternatively…

  1. Quit Mail

  2. In Finder, press ⌘ cmd+⇧ shift+G

    Copy and paste the following

    ~/Library/Mail/V2/MailData/
    

    Press return or click Go

  3. Backup then delete/move these files to the Trash:

    • Envelope Index
    • Envelope Index-shm
    • Envelope Index-wal
  4. Relaunch Mail and wait for messages to import.

Note: once in a while this causes a corrupted message or two to reveal itself, usually in the form of having no "From" or "Subject" in the list view of messages (at least in "Classic Layout" mode).

Sometimes a corrupted message can actually screw up the interaction between Mail and the server, even if message is corrupted not on Mac, but on the server itself! (seen happen w/ AOL).