Jan 18, 2012

Migrate kmail to thunderbird (convert maildir to mbox) preserving subfolders

Keywords: convert, migrate, kmail, thunderbird, maildir, mbox, hierarchy, tree
Depends on RPM(s) - openSUSE: procmail (for formail)
Download:  do_maildir2mbox

I used kmail for a while (not zillions of years mind you) and had it tweaked to meet my needs.  I didn't particularly care that the developers had decided (for me!) that I couldn't send HTML messages (there are valid times to do so) but I lived without that capability.

With kmail2 though, I couldn't get it to behave.  I struggled over many hours trying to import my kmail mail.  In the end, I did some research and switched to Thunderbird.  With add-ons, Thunderbird is quite awesome.

I wrote a shell script which calls formail to convert kmail's maildir format to mbox.  I found the information on the Web.  I wish I could remember the site so I can properly credit the author.  Suffice it to say, it wasn't me who came up with the idea of using formail.

The script is not what I would call production quality however it is useable.  It converts an entire maildir hierarchy into the corresponding mbox hierarchy.  Edit the script and change SRC_ROOT to point to the top-level directory/folder.  Also, if you have more than one drive, you should set TARGET_ROOT to another drive (for speed), otherwise, you can set it to a location with sufficient disk space.

The script does not handle single folder maildir files.  For these, you can manually convert them - see the formail call toward the end of the script.  Single folders (not hierarchies) are trivial to convert.

Ah, one other item, the script only converts information which is cur therefore ensure you have no new messages.  I'd suggest before starting, POP3'ing your mail, put kmail offline and start.  Try a few runs before taking the plunge.

1 comment:

  1. It works smoothly. Many thanks, indeed!

    ReplyDelete