Some time ago, I set up my Gmail account in Apple Mail to copy over messages which were not sent to my jimmitchell.org account. I’m one of those guys who likes to have everything all in one place at my finger tips when I need 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.
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 it is. Your Apple Mail Envelope index has been rebuilt. A very simple solution to a problem that has baffled some of the best Mac users.
I needed this. I did it. It worked perfectly.
Thank you!!!! Good, clear & concise instructions.
I’m a happy Mac again. 😀
Worked for me too. Thanks a million!
Great. This worked just perfectly. Thx
thanks – worked perfectly!
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.
Hmmm – your mail folder (from one account) used in a “Tester” (different) user account. Did you take the time to make sure permissions on the directory and contents were set to the Tester user first?
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: http://support.apple.com/kb/TS1907
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.
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 com.apple.mail.plist 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?
It worked! I imported my mail from an old windows live mailbox, then decided to move everything from the new imported mailboxes to the ones I wanted them to be in. Then I deleted the old mailboxes, then it hung up and I was stuck–till I followed your recommendation.
Excellent this worked perfectly for me where upon message were being sent to a mailbox that no longer existed. Many Thanks
Thanks, Will. Nice to know instructions that are nearly 10 years old still hold up. 🙂
I recently (in 2017) also rebuilt with this method. I was looking to see whether this is still the case, and what “Envelope Index-shm” and “Envelope Index-wal” are and I this page came up top in my Duck Duck Go search! It’s so good to have your name come up after so many years.
And yes, this method still works.
Deborah Shadovitz! Well isn’t your name a blast from the past! Hoping all is well for you.