At work I am busy migrating some Linux desktop users from an old Slackware 12.0 system with KDE 3.5 to Debian Squeeze with GNOME 2.30. So I had to migrate the e-mails from KMail to Evolution, a task which was not that trivial as you would hope at first.
On these systems, the mails were saved in ~/Mail. This directory did not contain a standard maildir structure or mbox files, but some weird mix of those two. I do not know whether this is typical for KMail or whether this was a peculiarity on these systems because the e-mails have been migrated from even other e-mail clients and versions in the past already.
The first step was to make a standard maildir out of this structure. I created ~/Maildir and searched for all directories called “cur” in ~/Mail. All parents of these directories are standard maildir folders, so I copied these to ~/Maildir. One of them was called inbox. In maildir, the inbox is just the parent directory and not some folder called inbox. So I moved the cur new and tmp subdirectories of ~/Maildir/inbox to ~/Maildir itself. Then I renamed all other subfolders in ~/Maildir so that they contained a dot before the actual folder name, as this is how subfolders are named in maildir.
Now I was still left with a few mbox mail folders. These are single files which contain a whole mailbox. In order to convert them, I used the mb2md script. I ran
mb2md -s ~/Mail -R ~/Maildir/ to convert all remaining mbox folders to the maildir structure.
Then I had a nice maildir structure, but Evolution cannot directly import Maildir folders. However it should be possible to create a local Maildir account in Evolution, pointing to the ~/Maildir directory and then copying over all folders. I did not try this. Instead, I installed the Dovecot IMAP server and edited /etc/dovecot.conf. I set these options:
protocols = imap
mail_location = maildir:~/Maildir
and restarted dovecot. Then I configured an IMAP+ account on localhost in Evolution, and dragged and dropped all IMAP folders to the local folders.
KMail’s address book is stored in ~/.kde/share/apps/kabc. Double clicking on the most recent vcf file there, should be enough to open and import it in Evolution.