Shock and Awe! My Emails are… – Gone! (sort of)

February 24th, 2014 by

No Mail HereOn Friday I received my new Retina MacBook Pro (13-inch). I love the “More Space” display resolution setting. Gives me the extra real estate I have sometime been missing so badly on the MacBook Air. Still looks stunning. Fired the new machine up with the Time Machine backup disk from the old machine attached, and had all my data transferred. Ready to go on the new system in less than two hours. Thank you Apple! After wasting some time with finding a new and cool desktop backdrop – the shock! All the smart mailboxes in Mail.app were — empty.

What the heck was this? In the local mail folders where I am filing my emails, all the messages were still there. But all smart mailboxes were showing no messages. As I changed some filed messages back to unread, I could get message counts to show up next to the smart mailboxes. When I clicked on one of them, the message count would disappear, and the smart mailbox would contain no messages. Bummer. One thing I use smart mailboxes for is extracting calendar invitations from the streams of incoming mailing lists. I can’t afford to miss one of those appointments, so this functionality is vital to me.

What now? As a seasoned power-user, the first thing that came to mind, was clearing out the Envelope Index (i.e. delete all files with “Envelope” in their name from ~/Library/Mail/V2/MailData). In order to be able to empty those from the trash, you have to reboot the machine. Logging out and back in again won’t help. After rebooting, emptying the trash, and launching Mail.app, it would show “importing messages” for some good 10 minutes (I’ve got a few Gigs worth of archive). And the – nothing. Still the same. Along the same lines, I deleted everything with “Smart” in its name from the MailData directory (and the Envelope Index also again to be on the safe side). To no avail.

In all the fiddling and biting my fingernails, I noticed that the search field at the top right of  Mail.app’s window would also not deliver any search results whatsoever. This made me suspicious of the Spotlight database, which can also be a source of joy if and when things go wrong. I cleared out and re-created the Spotlight database (as described here), and — voilà. This solved my problem. What a relief.

What seemed to have happened was that when I set up the new system, Spotlight indexed the email messages before the folders were restored from the Time Machine backup. Hence Mail.app wouldn’t find anything, as Spotlight’s indexes for email messages were empty. What should probably have happened is that Spotlight should have been notified by Time Machine about which files and folders have been restored. Hm, maybe in the next version…