Migrating Your Thunderbird Email to Haiku
In Haiku, each email message is stored as a separate file with email-related attributes (ie., From, To, Subject, Status, etc.). In contrast, Thunderbird stores all messages for any given folder in a standard plain text mbox file, where all messages are concatenated in a single file (more details about mbox, in case you are curious). Fortunately, there is a rather simple way to migrate your Thunderbird messages to Haiku email files, by using a little known command line utility called mbox2mail. This small but useful command line program converts mbox email files into individual Haiku email files and adds their corresponding email file type attributes.
Locating the Thunderbird accounts
First we need to locate where the email files that we want to convert are located. Thunderbird creates a profile folder under which it stores email files in separate account folders. The specific location of the files will depend on whether you use POP or IMAP accounts, and on the operating system that Thunderbird is installed on. For the sake of reference, let's take a look the location paths in the case of Ubuntu Linux and Windows:
Ubuntu Linux
/home/[username]/.mozilla-thunderbird/[profile]/Mail /home/[username]/.mozilla-thunderbird/[profile]/ImapMail
Windows
c:/Documents and Settings/[username]/Application Data/Thunderbird/Profiles/[profile]/Mail c:/Documents and Settings/[username]/Application Data/Thunderbird/Profiles/[profile]/ImapMail
Each of your email accounts will have its own folder under the above location. So if, for example, you have a POP account for haiku@gmail.com, you will find a folder named haiku@gmail.com, inside which you will find the email files for this account.
Identifying the email files to migrate
In Thunderbird, all the messages for each email folder of any given account is stored as two files: one having exactly the same name as the email folder, and the other with the same name but with the .msf extension. This is what a typical Thunderbird POP account looks like, as seen from Haiku:
Of the files you see in the above screenshot, the ones without the extension are the mbox files that contain the email messages: these are the files containing the messages that you will be migrating.
Moving the mbox file to Haiku
Assuming that your Thunderbird installation is on an ext2/3 Linux partition or a FAT or NTFS Windows partition, moving the Thunderbird files to Haiku should be easy: just mount the partition, browse to where the Thunderbird email files are, and copy them over.
Converting the email files
Now, let's see how to actually convert the Thunderbird email files into Haiku emails. In our example, we are going to assume that we are converting a Thunderbird file named "Inbox", and that the Haiku email files are to be placed in the /home/email/webmaster@haikuzone.net folder; the procedure is the same for any file; you just need to change the [InputFile] and the [OutputDirectory], as seen in the syntax of the "mbox2mail" command shown below:
mbox2mail [InputFile] [OutputDirectory]
To do the actual conversion, proceed as follows:
- Place the "Inbox" Thunderbird file in your /home/email folder.
- Start Terminal from Deskbar > Applications > Terminal.
- From Terminal, issue the following command to change to the mail folder:
cd mail
- Then, use mbox2mail to start the conversion process (it is case-sensitive, so beware):
mbox2mail Inbox webmaster@haikuzone.net
As mbox2mail converts each message, it shows the progress on the Terminal window. Once done, the number of converted messages is shown and Terminal returns to the prompt. The specified output folder, shown on the left window of the screenshot below, is created automatically by mbox2mail.
All the converted emails are placed in the specified folder and, as can be noted from the following screenshot, the Haiku email attributes that are so useful (and essential) to running live queries has been added to each of the files.
Now that you have your email data in Haiku, you can manage it from Tracker or using an email client like Beam. Or you can use both selectively, leveraging the usefulness of BFS live queries, while at the same time taking advantage of the higher-level abstraction layer that an email client can provide.
