Trying to retrieve emails archived from KMail, it turns out that a substantial number of archived emails cannot be retrieved by the PIM import program. The most frequent error message being:
Failed to commit transaction
Is there a way to save as many as possible emails from loss, e.g. by a script converting archived emails to eml-format ?
another annoying feature of the PIM import program is that every failure to import an email has to be quitted by clicking OKmanually, which means hundreds or thousands of manual clicks required when importing large archives, just in order to save as many as possible emails from the archive. If these problems are not fixed soon, Kmail would have to be considered as unusable and dangerous email client !
Just a gentle reminder → KMail and the KDE Plasma PIM Suite are not maintained by openSUSE.
Please vent your frustration in the KDE Discuss Forum: <KDE Discuss>
But, do not expect a warm welcome – the reason is here: <KDE Schedules>
The Achilles Tendon of openSUSE Leap is the distributions policy regarding KDE Plasma 6 releases – KDE is updating with short, planned and documented release cycles. You can see in the KDE Schedules what is supported and, what is no longer supported.
There isn’t, «currently», any such such thing as Long Term Support of any KDE Plasma 6 release.
Yes, yes, I am aware of some discussions around the theme of a possible, future, KDE Plasma 6 version which could, possibly, be a LTS candidate but, the KDE Developer community ain’t there yet.
So, now some questions and a comment:
How did you archive your KMail directories?
Did you use the KMail automatic archive feature or, did you manually archive each directory?
If you used the KMail archive feature, the file containing the archived e-Mails is a BZ2 compressed tar archive; which you can inspect with the KDE Plasma application “Ark”.
re 1.-3.: I used the kmail archiving feature, archiving directories with subdirectories manually, which produced tar.bz2 archives, e.g. Archiv_inbox_2025-10-29.tar.bz2
KMail is able to import these tar.bz2 archives in principle, but failed with a big archive covering several years. I tried to unpack this archive and import from the unpacked directory, which partially worked now, but with numerous error messages [file cannot be added to kmail-import directory: ]transaction failed.
In addition each error message had to be “OKed” by manually clicking, probably several hundred times… For the user it is unknown which and how many emails may have been lost in the process.
A possible reason for the failures might be data corruption (from faulty hardware)
but that seem unlikely, because similar problems occurred with a newer archive also.
some speculations:
Another observation might indicate a potential sychronizing problem between the PIM import program and kmail: maybe kmail puts adding additional emails on hold, if there is already a big queue of emails to be imported from PIM import program.
This is based on the observation, that the kmail counter for new emails often starts to work again, if the OK-button for the error message transaction failed is clicked not immediately but with a larger time delay…
OK – possibly a known issue with the KMail archive feature which has been possibly resolved with a newer KMail version.
You could report this issue on the KDE Bug Reporting – <KDE Bugtracking System>.
But, please explicitly ask if, the issue has been resolved in a newer KMail version.
The version of KMail shipping with Leap 16.0 is, AFAIK, no longer being supported by the KDE Plasma developers.
What you could do is, to unpack the large .bz2 to a local user directory.
You’ll have to use KRename to add the suffix ‘.eml’ to each e-Mail file.
Then, you can “divide and conquer” → split the e-Mail mass into useable goups of about 1 MB or 2 MB and then, import each group into your KMail instance.
You may have noticed that, I have a local e-Mail folder named “Z7-Imports”.
When I have to restore e-Mails from my Archives, I import to a folder below that local Akonadi instance and then, if the import checks OK, I then move the needed missing e-Mails to the working directories.
Any unneeded imported e-Mails are then, simply deleted …
If these problems are not fixed soon, Kmail would have to be considered as unusable and dangerous email client !
It IS a dangerous app. Last time I tried, it deleted all my emails instead of a few some I intended to delete, without any warning, by one button pressed when I was in a very confused state. The delete was also unrecoverable. Yeah I have a grudge against this app, but if you do research you’ll see it doesn’t have a good reputation. So I advise against using it.
in order to find whether a particular email can be retrieved despite import problems with KMail and PIM import program, I used the following bash script:
files=( $(ls /home/user1/inbox/cur/))
for str in ${files[@]}; do
FR=$(grep '^From: ' "$str")
SB=$(grep '^Subject: ' "$str")
DT=$(grep '^Date: ' "$str")
echo "$str;$DT;$FR;$SB; "
FR=''
SB=''
DT=''
done > EmailList.csv
This creates a table of all emails. The csv-formatting works for most of the emails correctly.
If KMail fails to import any single email, one might try with other email clients.