Files
blog/content/posts/2026/import-outlook-pst-into-kmail/index.md
T

116 lines
4.1 KiB
Markdown

---
title: How to import emails from a .pst file into KMail
description: >
Using a tool called "readst" you can transfer emails from an Outlook
account into any other email client, for example KMail.
date: 2026-05-15T17:30:00+02:00
draft: false
# ShowLastmod: true
scrolltotop: true
images: []
tags:
- email
- KDE
- Linux
---
Here I describe how I imported an email archive from Outlook to KDE's
[KMail][]. This turned out to be harder than expected.
My machine is a Fedora 44 KDE box, but the procedure should be the same or at
least very similar on other Linux systems.
## Prerequisites
Let's assume the following:
1. An Outlook archive file named `archive.pst`.
2. Inside this archive file: An email folder structure with first-level folders
in the style of `MyFolder1`, `MyFolder2` etc. and subfolder
`MyFolder1/MyFolder1Subfolder1` and so on.
I use the venerable [readpst][] tool to extract folders and emails from the
archive file. It's included in common Linux distributions, but at least on
Fedora you don't install it directly, but rather the `libpst` package:
```fish
sudo dnf install libpst
```
```fish
# dnf info libpst
Updating and loading repositories:
Repositories loaded.
Installed packages
Name : libpst
Epoch : 0
Version : 0.6.76
Release : 28.fc44
Architecture : x86_64
Installed size : 192.7 KiB
Source : libpst-0.6.76-28.fc44.src.rpm
From repository : <unknown>
Summary : Utilities to convert Outlook .pst files to other formats
URL : http://www.five-ten-sg.com/libpst/
License : GPL-2.0-or-later
Description : The Libpst utilities include readpst which can convert email messages
: to both mbox and MH mailbox formats, pst2ldif which can convert the
: contacts to .ldif format for import into ldap databases, and pst2dii
: which can convert email messages to the DII load file format used by
: Summation.
Vendor : Fedora Project
```
## Working solution as of 2026
Modern [KMail] does not store emails in the traditional storage formats such
as [Maildir] or [Mbox]. It uses KDE's Akonadi database system. Therefore,
we need to first export all folders and emails from the Outlook data file,
then import these into KMail's database using the `File > Import Messages...`
command.
At first, I struggled a bit to find the correct output format option to make
it work. `readpst` offers a number of different formats -- basically various
flavors of the [MH][]/[maildir][] and the [mbox][] structures. It did _not_ work
with the `-k` option that is meant to produce a dedicated KMail format. I ended
up using the simple `-e` option that produces a directory structure according
to the folders in the Outlook archive, with one separate file for each email
message.
1. Export folders and emails from the Outlook data file:
```fish
readpst -e archive.pst
```
There is no need to create and specifiy a dedicated directory, because
`readpst` will create a directory structure with a generic top-level
directory (in German, this directory is called "Outlook-Datendatei",
Outlook data file).
2. Import the folder structure and emails into KMail:
a. In the `File` menu, choose `Import Messages...`.
b. In the Import dialog that appears, choose "Import KMail Maildirs and
Folder Structure".
{{< figure src="kmail-import-dialog.png" >}}
c. At the bottom of the dialog where it says "Please select the folder to
import to", click on the folder icon. Choose the existing "Local Folders".
There is no need to create an extra folder for the import because KMail
will create folder "KMail-Import" just for you.
d. Click on "Next" and choose your `.pst` file.
e. Start the import process.
3. All imported messages are marked as unread at first, but this will go away
after a while.
[KMail]: https://apps.kde.org/kmail2
[maildir]: https://en.wikipedia.org/wiki/Maildir
[MH]: https://en.wikipedia.org/wiki/MH_Message_Handling_System
[mbox]: https://en.wikipedia.org/wiki/Mbox
[readpst]: https://www.five-ten-sg.com/libpst/rn01re01.html