Sunday, December 18, 2011

Thunderbird: The file Mailbox [filename] Cannot Be Found

I was using Thunderbird 3.1.16 in Windows 7.  I had a Hotmail account set up in T-bird, with the usual folders (Inbox, Drafts, etc.), and I also had a folder called E-mail Archive set up under Local Folders.  I was in the habit of removing messages from Hotmail's Inbox, when I was done with them, and storing them in the E-mail Archive folder.

Then I ran into a problem.  I clicked on a message in the E-mail Archive local folder and saw that there was no message body.  I could still see the From, To, Date, and all that, but the text of the message was gone.  At about the same time, I got an error message.  It said something like, "The file mailbox:///C|/Users[filename] cannot be found.  Please check the location and try again."

I ran a search.  It appeared that this was a pretty rare problem.  A different search led to a MozillaZine page that led me to think the problem was that I had not been compacting the E-mail Archive folder often enough.  The page said that compacting was a way to keep folders in good shape.  If I saw an email message with a weird date (e.g., sometime in 1969), that was a sign that the folder had become corrupted and should have been compacted.  I had indeed seen a message or two like that.  I had already set automatic compacting (Tools > Options > Advanced > Network & Disk Space), but apparently my value of 50MB (i.e., "Compact folders when it will save over 50000 KB") was too high.  So now I set that to 5MB instead.  It sounded like I would now be getting compaction prompts more frequently.  That webpage had advice on how to respond to this error message if the problem was with the Inbox, but that wasn't my problem.

Another MozillaZine page offered tips on how to set up and maintain Thunderbird.  I had stayed with version 3 instead of updating to a newer version of Thunderbird (currently 8.0 was the lastest) because I was using some add-ons that weren't compatible with the newer versions.  But this webpage seemed to offer a way around that.  So one possibility at this point was to upgrade and see if that would somehow solve the E-mail Archive folder problem as well.

Before doing that, it looked like there might be something I could do to retrieve the E-mail Archive folder within my existing setup.  One thread gave me the impression that an email folder might consist of a pair of files, working together.  One would have a name like REMC#1.msf, and the other would be REMC#1 (without the .msf extension).  I used Everything to search for *.msf files.  My system had 34 of them, all in the Thunderbird folder.  Originally, it seemed, the default installation location for Thunderbird in Windows 7 was at C:\Users\<account>\AppData\Roaming\Thunderbird\Profiles\[8 random characters].default, but I had moved that folder to drive D.  Specifically, I saw an E-mail Archive.msf file in that folder; but when I searched again for that filename, there wasn't an accompanying E-mail Archive file (without the extension).  I did have a backup of one, though.  It was big -- 500MB, apparently containing my tons of emails that should have been compacted.  So now I closed Thunderbird, copied that backup file (i.e., E-mail Archive) to the Thunderbird folder alongside E-mail Archive.msf, moved (instead of deleting) the E-mail Archive.msf as advised, and started T-bird again.

While doing the necessary screwing around in vague efforts to find a possible solution, I had already closed T-bird once before, after discovering the problem with the E-mail Archive folder, and when I started T-bird again, that folder was completely gone.  My guess was that the *. file (that is, E-mail Archive, without the extension) was responsible for telling T-bird that it should display a folder called E-mail Archive.  So when that non-extension file disappeared, so did Thunderbird's indication that I was supposed to have a Local Folders folder called E-mail Archive.

But now that I had copied the E-mail Archive *. file from backup to the Thunderbird folder, I did once again have an E-mail Archive folder visible under Local Folders.  I clicked on it.  The status bar said "Loading message . . ." for a minute, and then it was ready to show me the message bodies (i.e., the text of my email messages) once again.  So, wow, problem solved.  I dragged a boatload of messages from the E-mail Archive folder to another local folder.  I did that because it seemed that the E-mail Archive folder had gotten too big to work properly, so I wanted to reduce its contents before doing anything else.

Some months earlier, I had undertaken a project to remove old emails from Thunderbird and put them into individual PDF files.  It was convenient to have recent emails in T-bird, where I could quickly search for and reply to them.  But as messages got older, it was less likely that I would be using them for that sort of search and reply.  I decided to create a Thunderbird local folder called Ready to Archive, and I moved all messages older than six months into that folder.  I was a little superstitious about the E-mail Archive folder, so I decided to replace it with a new folder called Email Archive (without the hyphen). So I moved the messages that were less than six months old into Email Archive.  Now the E-mail Archive folder was empty.  Searches in Everything now showed that my new folders -- Ready to Archive and Email Archive -- were a couple hundred megabytes each.  Together, their sizes came close to the total size of the old E-mail Archive folder, and the combined numbers of emails in those folders (as displayed in the status bar at the bottom of the Thunderbird window) added up to approximately the correct total.  (I didn't think of recording the exact number before moving those items out of the old E-mail Archive folder.)  So it looked like things had worked out.  (Everything showed that the old E-mail Archive folder was still huge, but I guessed that compaction would probably shrink it down to almost nothing, if I had bothered to compact it.)

Deleting the E-mail Archive folder was not as easy as I thought it should be.  This folder had a different icon than the ones I had just created.  Maybe that explained why there was no right-click Delete option for this folder, and the Delete key didn't work.  I went into this folder's right-click > Properties and saw that there was a Repair Folder button that, according to the information provided there, might repair the .msf index file.  Nice to know, but I didn't need it anymore.  I closed Thunderbird, went into Everything, deleted the E-mail Archive and E-mail Archive.msf files, and restarted Thunderbird.  Now the E-mail Archive folder was gone, and the new Email Archive and Ready to Archive folders seemed to be working properly.

I closed Thunderbird, backed up the Thunderbird folder, and decided that my next projects in this area would be, first, to see if the advice cited above would work -- if I could upgrade T-bird while keeping my add-ons -- and, second, to take another shot at a hopefully streamlined process for that project (above) of converting old emails into PDFs.



Turns out that the E-mail Archive folder had a different icon because that was the folder designated to receive a copy of sent emails (Tools > Account Settings > click on Copies & Folders under each email account). Also, until I changed that setting, the old E-mail Archive folder would keep being recreated.