Migrating from KMail to Thunderbird

I recently moved from using KMail to using Thunderbird. Transferring the old email is non-trivial. Not only are the directory structure different, but KMail can use the maildir format for the folders, whereas Thunderbird only supports mbox format. When googling for a solution, I found the kmail2evo.py program which converts old email from KMail to Evolution. As Evolution also uses mbox format, I was able to hack the script to build a Thunderbird compatible directory structure. Follow these instructions at your own risk!

  1. Download kmail2thunder.py
  2. Start and then exit thunderbird, so it has generated its folder structure.
  3. Copy data out of special KMail folders (Inbox, sent-mail) as they will not be exported (to avoid smashing similar folder in Thunderbird).
  4. Run the script
        python kmail2thunder.py
    It will parse all your mail in ~/Mail and copy it to ~/tmpmail. You can use the -e option to the script to direct output directly to Thunderbird's Local Mail folder, but I do not recommend it. The script have other options that I have not tested, run it with the -h option to see the help screen.
  5. The script leaves an empty directory for each folder without subfolders, this is a bug in my modification. I do not plan to fix it, instead clean up the mess with this command:
       cd tmpmail 
       find . -type d -empty -exec rm {} + 
  6. Move everything in ~/tmpmail to ~/.thunderbird/XXXXXX.default/Mail/Local Folders, where XXXXX is a randomly generated string made by Thunderbird.
  7. Start thunderbird, and hope the best...


Last modified: 26 October, 2009 by Jakob Schiøtz.