Syncing / merging Thunderbird mailbox files
When I shifted to India seven months ago I took my netbook with me and sent my work horse desktop computer by cargo. Due to several circumstances - one of them being the trouble of getting reliable broadband access - I kept reading and writing my mails from the netbook, even long after the desktop had arrived.
Now was the time to do the transition back to the desktop. I had kept all my mails on the mail server during the whole time, so my inbox would be in sync just by downloading all mails. But I wanted to have access to those mails I had sent as well.
Thunderbird has no inbuilt option to migrate or merge messages from a file into your existing account. Worse, there are no provisions to keep two Thunderbird installations in sync.
Luckily Thunderbird uses the mbox file format to store the mails of a folder such as the Inbox or Sent in a single file. The format is widely used, especially in the *nix world.
With a bit of research I found that I was not the only person with this problem and even better I found the blog by Paul Betts containing an article "Merge Thunderbird / Evolution style (mbox) folders".
Paul wrote a program "mboxmerge" that is capable of merging any number of mbox style files into one, without duplicates and without loosing mails - in my case at least. Using it is as easy as it gets:
mboxmerge.exe Inbox_A Inbox_B > New_Inbox
This will merge the two files Inbox_A and Inbox_B into a new file New_Inbox.
In my case what I did was make a copy of the whole Thunderbird "Mail" folder from both my netbook and my desktop and call mboxmerge like this
mboxmerge.exe Netbook\accountname\Sent Desktop\accountname\Sent > Merged\accountname\Sent
The two "Sent" files got merged into a new one. I then took the newly created Sent file from the "Merged" folder and moved it back into my original Thunderbird folder, overwriting the existing file. Since I had the backup anyways there was no need to keep a copy.
In fact if you'd rename the original Sent file and start Thunderbird you'd see a new mail folder in your account. Easy to fix, but annoying.
All that was left to do is start Thunderbird on my desktop with the merged Sent folder and verify that both the old and the new mails were still present. They were. mboxmerge made my day. Thanks Paul!


December 14th, 2009 - 22:15
Awesome, glad it was helpful!