Mozilla Thunderbird

How To Share Mail Between Windows and Linux

An increasing number of people are using more than one operating system. Linux is a great alternative to Windows, but many people feel that they don't want to abandon Windows completely. This tutorial will show you how you can share your local mail storage between the two operating systems on a dual boot computer.

In order to achieve this, the following steps needs to be performed:

  1. Create profile in Windows
  2. Prepare Windows profile
  3. Create profile in Linux
  4. Copy prefs.js from Windows profile to Linux
  5. Modify Linux prefs.js

1. Create profile in Windows

The first step is to create a new Thunderbird profile in Windows. If you already have a profile with the mail you want to share, you can skip this step, but if the existing profile is currently on an NTFS partition, you should move it. It is important that the profile is stored on a FAT32 partition, because Linux usually cannot write to NTFS partitions.

Let's say you have a drive called C:, which is a FAT32 partition. Start Thunderbird with the Profile Manager by running thunderbird.exe -p. Create a new profile called e.g. MyMail and choose C:\ as the folder to store it in. The profile will then be stored in something like C:\MyMail\1a2b3c4d.slt.

1a2b3c4d.slt mentioned above is a random subfolder added by Thunderbird for security. Just for the record, it is possible to remove this extra subfolder, but that is subject to a separate tutorial. To keep things simple, we will assume this folder is still used.

2. Prepare Windows profile

Now it's time to setup all the mail accounts that you want to share between the operating systems. If you moved an existing profile instead of creating a new one in the step above, you can skip this step too. Assuming that you created a profile at the location specified in step 1, your mail is now stored in C:\MyMail\1a2b3c4d.slt\Mail.

If your mail folders are still empty, write a new test message and choose File > Save to save it in the Drafts folder. This will be useful later on to verify that you can access the mail from Linux.

3. Create profile in Linux

It's time to reboot to Linux. We will assume that you use the default location for the Linux profile, which is ~/.thunderbird/default/1a2b3c4d.slt. Just start Thunderbird and a profile will be created there. (If you already have a profile at that location, just delete it first.) Cancel the New Account Wizard that pops up and close Thunderbird again.

4. Copy prefs.js from Windows profile to Linux

The rest of this tutorial assumes that the FAT32 partition containing your Windows profile is mounted with read/write access. Some modern Linux distributions (e.g. Mandrake Linux) do this automatically to locations like /mnt/win_c, /mnt/win_d and so on. Some other distributions don't help you with this. In this tutorial, the Windows C: drive is mounted to /win/c.

Copy the file /win/c/MyMail/1a2b3c4d.slt/prefs.js to ~/.thunderbird/default/1a2b3c4d.slt/prefs.js. This will carry over all the settings for the Windows profile to your Linux profile.

5. Modify Linux prefs.js

Now it's time to do the magic that makes all of this possible. Open ~/.thunderbird/default/1a2b3c4d.slt/prefs.js in your favorite text editor (e.g. gedit, kate) and search for lines containing "C:\\MyMail". These lines use absolute Windows paths that must be updated. Example of a few lines:

user_pref("mail.root.none", "C:\\MyMail\\1a2b3c4d.slt\\Mail");
user_pref("mail.root.pop3", "C:\\MyMail\\1a2b3c4d.slt\\Mail");
user_pref("mail.server.server1.directory", "C:\\MyMail\\1a2b3c4d.slt\\Mail\\pop.myisp.com");

Change the above example lines to:

user_pref("mail.root.none", "/win/c/MyMail/1a2b3c4d.slt/Mail");
user_pref("mail.root.pop3", "/win/c/MyMail/1a2b3c4d.slt/Mail");
user_pref("mail.server.server1.directory", "/win/c/MyMail/1a2b3c4d.slt/Mail/pop.myisp.com");

Finally, remove any lines containing "[ProfD]". These are relative paths which will be generated automatically. Examples of lines to remove:

user_pref("mail.root.none-rel", "[ProfD]Mail");
user_pref("mail.root.pop3-rel", "[ProfD]Mail");
user_pref("mail.server.server1.directory-rel", "[ProfD]Mail/pop.myisp.com");

That's it! Now start Thunderbird in Linux and verify that you can see your mail. Create a new draft message and then reboot to Windows and verify that the draft is accessible from Windows.

Get Firefox! © 2003-2004 David Tenser.