I almost had a heart attack today when I opened up my Thunderbird email client after setting up and removing some SMTP accounts. Of my three main email accounts, the primary account that I use here in Jordan had suddenly vanished, taking out about 6,000 emails from the past year. I had been using a plugin called SmtpSelect to help better catalog my numerous email aliases and sub-accounts, and when I disabled it, suddenly all of my Gmail was gone.

After I recovered from my initial shock, I realized that with almost 500MB of data in that IMAP folder, I would have had some serious hard drive action if it had actually deleted the messages. So I went to c:\users\zth\appdata\roaming\thunderbird\profiles\account.default\ImapMail and sure enough, there was my Gmail folder, still there with no apparent damage done to it.

But I simply could not figure out how to get Thunderbird to realize that the folder was still there and parse the data out of it. There was no “import” button in the program and desperate Google searches were turning up nothing.

I sorted the account.default folder window by date modified so I could try to pinpoint what files might have been edited in the past 10 minutes. Cookies, plugins, the Thunderbird 3 index database (at a whopping 168MB), and something called “foldertree” which was a lot less helpful than I hoped it would be.

The key was in a small file called prefs.js. I had ignored it first, figuring it was a Javascript file but “preferences” was too intriguing to pass by twice. I opened it up in Notepad and examined it. Sure enough, it contained all of the different account records and folder links back out to Windows Explorer. Exactly what I was looking for. All of my other accounts were referenced in there in their specific ImapMail subfolders, but my main Gmail account was conspicuously absent.

prefs.js recovery

It would have been difficult but not impossible for me to look at my secondary Gmail account and be able to piece things back together for how the account properties were coded into this prefs file. But backups came to the rescue! That and the automatic Windows Vista/Windows 7 ”previous version’ function, which completely saved me. I merely right clicked on the prefs.js file, selected the “Previous Versions” tab, and selected the most recent automatic backup of the file from last week. I clicked “Restore”, crossed my fingers, and opened up Thunderbird again.

Done. The prefs.js file had instantaneously restored all of my accounts back to their former selves and everything was being parsed properly. It was then that I realized I had been holding my breath for 20 minutes straight.

I was pretty proud of myself; it was one of the few times I’ve ever actually lived up to my so-called “technician” reputation and actually figured out something for myself as opposed to turning to the Internet for guidance. Of course, that’s exactly why I wrote this blog entry, in the hopes that perhaps it will help someone else out.