From KMail to Thunderbird

I think every Linux desktop user which uses KDE agrees that when we update to a new KDE4 release – either because it comes as part of system update or by installing the new distro – the first question we ask is what exciting features were introduced in this new release and which basic functionality got broken because of that?

Recently released OpenSUSE 12. 1 introduced the new KDE 4.7.2 and KMail version 2. I have been a SUSE Linux user for quite a while, and to be honest this was not the first release packing a version of KMail which didn’t quite work straight out the box. Some previous versions need tweaking as well. However this version was just a disaster. First, it didn’t see the mail folder at all, instead asking me to import it; this never happened during the last ten years I’ve been using KMail. Now, the importer crashed while importing the email. And while this would probably be fixed eventually, it was the turning stone as I didn’t feel right about the overall direction the KDE PIM suite was moving. It always reminds me about Architect Astronauts so amazingly described in Joel’s blog post.

So the decision was made to finally dump KMail. And after considering the alternatives I decided to try Thunderbird. The pros are obvious: the product is quite stable, there is a large community built around it, and it doesn’t require MySQL running in the background. And it is easily extendable the same way Firefox is – with the community-written plugins. The cons were also obvious: Thunderbird uses the outdated MBOX format to store mail instead of more modern (and, in my opinion, simply better) Maildir supported by KMail. It has an  unfamiliar user interface, and lacks some KMail  features I was used to. Most of those issues, however, have been working out. At this moment I’ve been using Thunderbird successfully for a month and feel happy about it.

With the help of this series of posts you hopefully will get a working Thunderbird installation which will preserve the old emails as well as the mailbox structure, and give you the e-mail client with the same – or even better – capabilities than KMail ever was. This article doesn’t cover contact migration since my contacts were kept in LDAP – they got migrated when I installed OpenSUSE 11.4 which had broken PIM – but this shouldn’t be too difficult. Thunderbird supports import from LDIF, VCF and CSV so just export your contacts in KMail and import it into Thunderbird – or, even better, LDAP.

This article is for experienced Linux users. You do not have to be a programmer, but you must be comfortable working in the console, have no issues with moving files between directories and download and run scripts.

Preparation

Before you start, make sure you have the full backup. Sure, the chance is nothing would go wrong, but if it would, the backup would be something which would save your day.

Shut down the KMail process if you have it running. Make sure it has finished, not just disappeared. There was a bug when KMail IO slaves were kept running in the background even after KMail was closed, and kept updating the mail folder. You do not want any external modifications to your mail folders while you’re converting the emails.

Install Thunderbird and configure just one e-mail account (it will guide you through the account configuration upon the first start). If you use POP3 access, make sure that you click on “Advanced config” button and under the  “Leave messages on server” uncheck the “For at most 14 days” box. This will ensure you won’t lose any emails if the conversion goes wrong and you want to get back to your previous configuration. You need this so Thunderbird creates a profile directory and you’ll know where your email will be stored.

Now close Thunderbird as well as you do not want it to modify the e-mail folders you’re converting email into.

Converting your old emails

Before proceeding through this chapter check whether you need to convert your emails at all. If you’re using IMAP protocol to access your email, and all your emails are stored at server, you do not need to convert anything at all. All you need to do is login into your account in Thunderbird and synchronize emails with the server. Then you can proceed to customization.

If you previously configured your KMail to keep the e-mail in Maildir in MBOX format, you’re lucky and you do not have to convert anything. Just copy your mbx files to the Thunderbird mail directory which you can find in the Account Settings for your account in the Server Settings submenu.

Now if you’re like me and you used POP3 to retrieve all your e-mail from the server, and have your email stored in Maildir – you need to convert it to mbx format for Thunderbird to understand. There are zillions of scripts for this task, and after trying twenty or so of them I found a Python script kmail2thunder.py. This script even generates the Thunderbird folder structure which is very helpful when you have a complex one. Download the script, and execute it passing the -k switch followed by the path to KMail Maildirs directory, the -e switch followed by the path to Thunderbird mail directory and -i ” switch to indicate we want to convert inbox, outbox, sent and trash folders:

python kmail2thunder.py -k ~/Mail/.Gmail-directory \
              -e ~/.thunderbird/b5sah78j.default/Mail/pop.gmail.com/ -i ''

Note that I passed the path to the subdirectory which belongs to this specific account, as I’m converting the mail account by account. Of course you need to have Python installed (you can uninstall it after conversion if this is an issue for you, don’t worry).

After the script succeeds you should have the emails converted to MBOX format and stored in the Thunderbird folder. Start Thunderbird and see your old mailboxes intact. Note that the first start may take longer than usual since Thunderbird needs to index your mail.

If you’re happy with the conversion result, add the rest of your accounts and convert the rest of emails.

Getting used to Thunderbird

At this moment you have a working e-mail client with your previous email storage. However the look and feel is different, and you probably miss some functionality. The keys also work differently. Below you find the list of things which you need to get used to, and things you can change. Go to Tools/Add-ons and install the extensions which will make your life easier.

In the next post I’ll list the addons which will add some of the missing KMail functionality into Thunderbird.

This entry was posted in Email.

6 Responses to From KMail to Thunderbird

  1. I’m eagerly looking forward to moving from KDE and Kmail (Kmail was the proverbial straw…) However, I really don’t want to loose maildir. So I’m hoping the pluggable store get’s sorted in the next few months and then I can hopefully transition sometime after May.

  2. George says:

    I have done it already. There is much better solution, and I’m going to write a few articles about it in a week or so.

  3. erik says:

    He George.

    i am ready to push the enter to start converting.
    But tell me, did you write something about the much better solution?

    • George says:

      Yes. See the follow-up posts about creating your own mail setup.

      • erik says:

        aha, uf, too difficult.
        btw, the conversion is not working. Because of empty cur folders. Probably a too new version of kmail…

        • Marko says:

          I also got error messages, but the script run fine when I directed to the main mail folder, ie ~/.kde/share/apps/kmail/mail

          Thanks for the great script, it saved my very old e-mails when

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.