Migrating from KMail to Thunderbird
The last few years (I don't really remember how many) I've used KMail as my e-mail client in my Gentoo Linux box. At work, where I have to use Windows, I use Thunderbird, Mozilla's e-mail suite. Both are excellent programs, but some things regarding KMail made me leave it behind and migrate to Thunderbird in Linux too.
Some of the reasons for this decision is that KMail 1.x is not maintained anymore (other than small bugfixes maybe?). I tried to migrate to KMail 2 last summer, but the experience was painful at the time. The migration to version 2 was ok, but with all this Akonadi stuff, I started having huge files at my home directory because of the indexing process and the application itself was sluggy. I also lost a few messages, fortunately not a big loss. So, I went back to KMail 1.x at the time (I kept backup, I used version 2 for a day or something). However, I see that Thunderbird is actively maintained and more features are added to the suite.
In this post, I will explain how to migrate all your messages from KMail to Thunderbird.
Some introductory stuff
KMail uses the maildir format to store its messages. Practically, each message is saved in a separate file and there are a few index files along with each directory (folder in the KMail view). On the other hand, Thunderbird uses the mbox format. Each folder is actually a big file, a concatenation of all the messages that the folder has. I guess each method has its ups and downs, but this is something out of scope for the current post.
The KMail version I used until now is 1.13.7, while Thunderbird is 12.0.1.
The migration process
It's 99.9% possible that you use the maildir format for KMail. You can always change to mbox, but you have to explicitly do this while creating a new folder. Thunderbird does not offer such an option. By default, it uses the mbox format.
After doing some Googling, I found out various posts regarding KMail to Thunderbird migration, but none of them seemed not "dangerous" or rock solid. Then, I came across to this forum, where a user simply explains that creating a new folder in KMail with the mbox format and simply copying all messages there will do the trick! And then, I realized that this should work. And it did.
What I did is to create two folders using the mbox format, one for the incoming messages (inbox) and one for the sent messages. I then copied all inbox and sent messages in each corresponding folder (depending on the number of messages in each folder, it should take some time, not too much though) and then, I was ready to copy the mbox files to the Thunderbird profile directory.
What happens when you have subfolders in your folder messages? If for example, you have a folder named Linux and a folder under it named Gentoo, then, in KMail mbox format, you will have a Linux file in the filesystem and a .Linux.directory directory. The first in the folder Linux with all its messages, while the second is the directory that holds any folders under Linux (in this case the Gentoo folder). In this folder, you will have a Gentoo file that holds all messages under the Gentoo folder.
Thunderbird uses a similar structure. In the example above, it would have a Linux file and a Linux.sbd directory that will hold the Gentoo file (the Gentoo messages folder). So, what you must do is to copy the Linux file and its corresponding .Linux.directory directory under Thunderbird's profile folder and rename .Linux.directory to Linux.sbd. You must rename all the .<name>.directory directories to <name>.sbd and you should be set. When you are finished with all your folders, fire up Thunderbird and after a few seconds to create its indexes, you should be ok. Thunderbird's index files are files ending in .msf.
In each .Linux.directory directory, KMail stores some other index files (ending in extensions like .index). You are free to delete them, Thunderbird won't need them.
So, by simply transferring all your messages in KMail from the maildir format to mbox and copying the underlying system files under Thunderbird's profile you will have migrated all your messages to Thunderbird. Of course, other things like KMail rules must be created by hand in Thunderbird. The address book can be exported in a comma separated file (.csv) and imported to Thunderbird easily. No hacks, no third-party scripts and you are done. Of course, in all cases, before initiating the procedure, BACK UP your files!
So, migration went fine. I'm using Thunderbird at the moment. The migration had some cons, like losing KMail's integration with KDE and using the filtering system in Thunderbird, which is inferior to KMail's. But, other than that, I'm happy.
I hope you found this post useful. Feel free to ask anything you'd like.