I ended up with thousands of these ghost messages after moving from Eudora to Apple Mail with the help of Andreas Amann's brilliant Eudora Mailbox Cleaner. I didn't worry too much about it, as the messages were there in duplicate.
But after a while I got tired of seeing double messages when searching the old archives. I couldn't find any way to scare away these ghosts. Rebuilding the mailboxes didn't help. Nor did running duplicate message scanners.
Even the fantastic vacuum command line cleanup routine wouldn't get rid of the ghost messages with their "Show in Mailbox" in the top right corner. But vacuum did get speed up Apple Mail (highly recommended).
sqlite3 ~/Library/Mail/Envelope Index vacuum;
But finally I found the solution on a long dead Omni mailing list archive.
Here's how to stop the haunting. The issue is with the Envelope index. It needs to be deleted. Steps:
- Quit Apple Mail
- Open up ~/Library/Mail
- Delete Envelope Index
- Restart Apple Mail
- Sit back and wait as the full index is rebuilt
Don't do this if you are in a hurry. For my 270,000 messages, it takes about twenty minutes to index them all (pretty spiffy coding Apple Mail Team, getting through that many messages that quickly).
But when it's done, your messages will all still be in place, but your index will be a whole lot faster. I don't know why vacuum only partially cleans and why Apple Mail doesn't have an effective built-in cleaning mechanism. But I'm happy that all systems are go again. Now that you know this trick to, you won't have to care either.
As a footnote, I should say that I was initially a reluctant switcher from the poor departed Eudora (the most robust and configurable email client ever). But Apple Mail handles my huge database of messages astonishingly well and looks quite a bit better doing it.
Alec has been helping businesses succeed online since 2000. Alec is an SEM expert with a background in advertising, as a former Head of Television for Grey Moscow and Senior Television Producer for Bates, Saatchi and Saatchi Russia.