Thunderbird2maildir

Due to security reasons, I need keep my mail both on my laptop, my home server and the desktop machine - with all of them kept in sync, of course. The ideal solution seems to be offlineimap that has the ability to sync local maildirs with a remote imap server. Installing Dovecot on the home server and moving all the messages from Thunderbird onto it was the first step.

Unfortunately, Thunderbird seems to want to store empty messages on the IMAP server which Dovecot does not tolerate - it cancels the transfer with "append aborted". Having 1.000 mails in a folder and Thunderbird showing the cancel message after 150 is kind of unproductive. Further, Thunderbird does not allow copying a whole folder tree between accounts - I have some 120 of them, and copying all by hand would take too long, even without the abortion problem.

What does a programmer do in such a case? Yes, you write your own script make something usable from Thunderbird's mbox files. PEAR has a nice little package called Mail_Mbox which I coincidental helped to develop. Using this I was able to extract all messages from my local ~/.thunderbird directory into a maildir-compatible directory structure. The code can be found in my Subversion repository.

Now I have dovecot installed both locally and on my server since there neither Sylpheed nor Thunderbird support maildir styles. But offlineimap can sync imap accounts, and that's what makes it.

Written by Christian Weiske.

Comments? Please send an e-mail. Or Reply or Like.