August 7, 2009

Simplistic Thunderbird Mail Sharing on Multi-Boot Linux/Windows Systems

I have a number of multi-boot systems, with various combinations of Linux and Windows on them.  I often find that when I have a partition booted where I do not normally keep my email, I get into a situation where I need to check something that is in my mail.  There are a few obvious ways to handle this - reboot to whatever partition has the mail, or keep the mail on a central server somewhere, for example - but none of them either fit my needs or are worth the bother at the moment.  The following simple solution is more than adequate for me.

Thunderbird keeps your mail folders in a directory, the location of which depends on the operating system.  Under Linux it is:

~/.mozilla-thunderbird/[random].default/Mail/Local Folders

 Of course, the ~/ above indicates your home directory, and the [random] is determined when you install Thunderbird.

Under Windows XP it is:

 /Documents and Settings/[username]/Application Data/Thunderbird/Profiles/[random].default/Mail/Local Folders

Under Windows Vista it is:

 /Users/[username]/AppData/Roaming/Thunderbird/Profiles/[random].default/Mail/Local Folders

 It turns out that once you know where the mail files are, you can simply copy whatever files and/or directories you want from one partition to another.  Simple mail folders in Thunderbird use two files in this directory, one with the name of the folder and one with a .msf extension added.  So a Thunderbird folder called friends would have a file called friends and a file called friends.msf.  A Thunderbird sub-folder is actually a subdirectory of the same name with .sbd added, in this directory, and then the mail folders in that subfolder will again have two files.  So a Thunderbird folder customers will have a directory called customers.sbd, and a mail subfolder called Johnson would have files customers.sbd/Johnson and customers.sbd/Johnson.msf.  It is possible to have both a mail folder and a mail subfolder of the same name - and now you know why, because it just means there will be a directory and two files with the same name.

So, if you have your mail on an XP partition, and you are booted from an Ubuntu partition, and you need to look at the mail folder  Employment, the steps would be:

- STOP Thunderbird on Ubuntu.  You don't want it running while you are monkeying around with its data files.

- MOUNT the XP partition, for example on /media/XP

- Open a file browser and navigate to the XP Thunderbird mail directory

- Open a file browser and navigate to the Ubuntu mail directory

- Copy Employment* from XP to Ubuntu

- Restart Thunderbird.  You should see the new mail folders and/or subfolders

Obviously, you have to be careful when doing this.  First, there are other files in the Thunderbird Local Folders which are not your mail folders - things like Junk filtering, Templates and the like.  Copying them is generally not a good idea.  Second, as with all such file copying, you can easily overwrite something and accidentally lose information.  You should be very certain that you know what you are doing, and that you are doing exactly what you mean to, before you copy anything.  The classic mistake, of course, is copying files in the wrong direction.

It would not be difficult to write a very short script to perform this copy, either for all of the "real" mail files and directories, or for specific names given on the command line.  Such a sctipt could then be included in either boot or login processing, so that current mail was always available under whatever partition you are running.

One last note.  If you are writing mail from several operating systems, and want to combine the Sent folders so that all outgoing mail is saved, you can do essentially the same thing, but rename the Sent and Sent.msf files (you have to rename both).  They will then show up under the new name when you run Thunderbird, and you can move the messages from that folder to the existing Sent folder.

Disclaimer.  I'm not saying this is a good solution, I'm only saying it is quick and easy.  If you find yourself doing this a lot, you probably need to think more carefully about how and where you are managing your mail.



Click Here!