How to migrate e-mails from KMail to Thunderbird?

Instructions

These are instructions how to import messages held in KMail 2 into Thunderbird. Versions were KMail 4.10.5 and Thunderbird 17.0.8, but should not matter for this to work.

  1. Install ImportExportTools in Thunderbird.
  2. In Thunderbird, create a folder into which you want your e-mails imported. This can be in "Local Folders", which is recommended, but also in an IMAP account. In the latter case, importing and uploading are done at the same time, so there are two error sources and the second step can not easily be repeated when it fails, without repeating the import step as well.
  3. Right-click on the new folder and select "ImportExportTools -> Import Messages".
  4. In the file selection dialog, go to ~/.kde/share/apps/kmail/mail/<your folder to import>/cur/, select "All Files" in the file filter at the bottom, and select all these messages (simplest by pressing Ctrl+A).
  5. After the import, all messages are marked as unread. Right-click the folder again and select "Mark folder as read" to fix this.

This should import all messages nicely and without errors. You may compare message counts to those in KMail.

Discussion

The above solution seems quite straightforward, but it really was the only working solution I found. Various other solutions are meant to work, but did not:

  • Uploading local e-mails to an IMAP folder in KMail, then downloading again from there in Thunderbird. Should work usually, but in other cases errors in KMail can be triggered. For example, creating a new folder is not possible in KMail if the e-mail server is based on courier.
  • Selecting a bunch of e-mails in KMail and right-clicking on them then selecting "Save as …" gives the option to save them all to one .mbox file. Which can then be imported with "ImportExportTools -> Import Mbox files …" in Thunderbird. However that import often fails, so that no e-mails are imported at all.

Posted

in

,

by

Tags:

Comments

8 responses to “How to migrate e-mails from KMail to Thunderbird?”

  1. Gord

    I have few folders listed and Inbox has no files. I believe my folders and messages are hidden away in akonadi or some such place.

  2. Gord

    I find that if I use the archive feature on a Kmail2 folder, it creates an archive file with the messages that I can extract into a folder hierarchy. I am now going to try adding an eml extension to the file names of the messages and see if they can be imported into Thnderbird.

  3. Gord

    Renaming the messages works but is tedious. A much better way is at this link http://eyemeansit.wordpress.com/2011/03/03/migrating-from-kmail-to-evolution-or-thunderbird/

  4. Gord, thanks for sharing your solution. For those wanting to keep with the “renaming to .eml” solution, there’s a more comfortable one-command way of renaming them: go into the directory with the e-mail files, then execute:
    for file in *; do mv "$file" "$file".eml; done
    (Not tested though, should work but test it first.)

    For the problem of not finding your e-mail files in the KMail folder: I think they are in subfolders, which are named as hidden files (starting with a dot). So just enable seeing hidden files in your file manager, and you should find them there.

  5. Holger

    Thanks a lot! … import was easier than setting up the broken kmail again.

    Rename was not necessary. There is a combo-box to just show “all files”. They reside in sub-folders like “cur” or “new” thought the assignment to those folders is completely bogus and does not reflect any new status those messages may have had before.

    Now I only need to resurrect the regular expressions I used to filter my inbox.

  6. Kmail seems to change the location where the actual messages are stored every new version. I found mine in :
    /home/user/.local/share/akonadi_maildir_resource_0/.Archimail.directory/
    And thanks to this tutorial managed to reimport my emails held histage by kmail into good ol’ Thunderbird.

  7. Wolfgang

    This approach worked in my environment:
    1. take a kmail export and unzip the export file
    2. change to directory: mails/akonadi_maildir_resource_0
    3. unzip the mail.zip
    4. find mail -name '*.servername*' -exec mv {} {}."eml" \;

  8. Edward

    Yes, still works with Kubuntu 22.04 and Thunderbird 91 in July 2022.

    Two differences for me:
    1) KMail messages are in (like Eric commented in 2020):
    /home/USER/.local/share/akonadi_maildir_resource_0
    Then e.g. go to “inbox” or “sent-mail”.

    2) My emails were all in the folder “new”, nothing in “cur” and nothing in “tmp”.

    For some reason Thunderbird only imported 10 per cent of emails in my first try. But on the second attempt (closed Thunderbird an started again) two folders with thousands of emails were nicely imported.

    Thanks a lot, great help. Worked perfectly!

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.