Rebuilding the Apple Mail Envelope Index

Some time ago, I had set up my Gmail account in Apple Mail in order to copy over messages that were missing in my online IMAP account. I’m one of those guys who likes to have everything all in one place at my finger tips when I want it.

After copying over the messages I wanted, I completely removed the Gmail IMAP account from Mail and went about my business. Soon after, when I went searching for a specific email, I experienced the phenomenon of ghost emails in the search results. These are messages that Mail once knew about, but no longer knows where they exist. The ghost emails were all from the since removed Gmail account.

If you’re experiencing the same problem, here’s a very simple fix to rebuild the Apple Mail envelope index.

First, quit Apple Mail if it’s running, then navigate your way to “~/Library/Mail/” (where “~” is your home folder) in the Finder. Once you’re in the Mail folder, you’ll see a file named “Envelope Index” which keeps track of where all messages are located. Rename “Envelope Index” to “Envelope Index Backup” (We don’t want to trash the file just yet).

Then, relaunch Apple Mail. You’ll be presented with a daunting “Message Import” dialog that looks like your email account was wiped out and you’re starting all over. Fear not. You’re simply rebuilding the Envelope Index at this point.

Apple Mail Envelope Index

Click “Continue” to rebuild the index. Once it’s done, all those pesky phantom messages will be gone the next time you perform a search in Mail (Yay!). You can then go back to the “~/Library/Mail/” folder in the Finder and move the file you renamed to “Envelope Index Backup” to the Trash.

And there you have it. Your Apple Mail Envelope index has been rebuilt. A very simple solution to a problem that has baffled some of the best Mac users.

What Others Have Said

  1. Darren says

    Failed miserably in 10.5.4 under Mail 3.4 on a test copy of my Mail folder on a Tester user account. It rebuilt the Envelope Index but with no information in it. All 7318 messages are unread, have no titles, and were received at the time of rebuild. Not to mention that there are no message contents to be seen when selecting one. All the .emlx files are there but none show any contents when opened directly (double click the file) into Mail.

  2. Darren says

    Good point. Absolutely, I did. (Had to. It won’t talk to Envelope Index otherwise.) I made sure that Tester had Read & Write permissions on the copied files. And then went to the top of the folder (~/Library/Mail) and copied the permissions to subfolders (Apply to enclosed items) to boot.

    Trick: this (below) kb article mentions an extra crucial step that solved the problem. After I replaced the original Envelope Index file to double check everything else was fine then pulled it again and a (Key step) MAC-XXXXXX folder from a MobileMe account, THEN let Mail rebuild the index (took 3 times as long, nearly 40 seconds) file and it was fine. And correct.

    So I made another copy of my real Mail folder and tried the simpler Mail menu Mailbox:Rebuild on the problem (Sent had ghosts that wouldn’t delete, just get greyer) and that worked on that one folder.

    All better now. So now I get to fix Address Book not syncing with MobileMe only on this account.

    Apple Kb Article:

  3. says

    Thanks Darren. Sounds like some lingering issues with MobileMe. I feel for you man (and everyone else who’s been dealing with MobileMe hell).

    Since I don’t use the service, this isn’t a factor for me. However, if you do use MobileMe, and are having issues, the kb article above is a good point of reference.

  4. chandrika says

    I tried this and several other strategies. Story…

    Setup account wanted to trash account/reset mail and found site to remove mail folder from library and from preferences. Did that and was able to resetup mail. However, the synch from my gmail account isn’t happening. I’ve tried this technique above and no luck…it won’t get the emails from gmail. I want to start from scratch…what do I do?

Join the Discussion

Your email address will not be published. Required fields are marked *