Bug 436191 - Kmail sometimes forgets the correct mapping of Sent and Draft folders
Summary: Kmail sometimes forgets the correct mapping of Sent and Draft folders
Status: CONFIRMED
Alias: None
Product: kmail2
Classification: Applications
Component: folders (show other bugs)
Version: 5.16.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-26 01:13 UTC by Gerion
Modified: 2023-10-04 16:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerion 2021-04-26 01:13:51 UTC
SUMMARY

When using Kmail with multiple accounts and a lot of folders, Kmail tends to forget the correct mapping of Sent and Draft folders sometimes.

STEPS TO REPRODUCE
1. Set up several identities and configure several Sent and Draft folders.
2. Use (and update) KMail a long time.

OBSERVED RESULT

Sometimes the configuration is mixed up and the Sent and Draft folders point to random other folders.


EXPECTED RESULT

The configured mapping remains the same.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Gentoo, KDE Plasma 5.21.4
(available in About System)
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.81.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

I'm pretty sure, this bug is known, but I didn't find it in the tracker. I have experienced this a long time (several years), always occasionally.

I could also kind of reproduce it, when I delete the Akonadi database (I have deleted the entire folder ~/.local/share/akonadi). In this case, Akonadi syncs again (all settings are preserved) but the mapping is gone or mixed up.
Since quite a time, KMail also displays a message, if the folders cannot be assigned anymore.

Therefore, I would guess that the mapping is not string based but indices based and the indices are assigned randomly, when Akonadi creates a new database.

However, this does not only happen when deleting the database. In rare cases, it also happens without any obvious reason (maybe an update?).

This whole reassigning could be quite dangerous with sensitive data. Let's assume you have two E-Mail accounts: "A1" and "A2" (both IMAP, both have an INBOX and a Sent and Draft folder). KMail is configured to put sent messages of A1 to the A1.Sent folder and drafts of A1 to the A1.Draft folder and the same with A2.

Now the mixup happens and A1.Sent points to A2.INBOX. After that, you send a message from account A1. KMail sends the message, puts it additionally in A2.INBOX, marks it as unread there, uploads it to the server (it is IMAP!) of the A2 account, the server executes some Sieve filtering and since A2 is a shared account, the mail is sent to a bunch of people. (This happened to me today. It was not a sensitive content, so the is was not that bad, but nevertheless unpleasant.)

Is it possible to change the assignment/mapping to a string based approach?
Comment 1 Sebastian Kügler 2023-10-04 16:36:20 UTC
Observing the same problem, kmail regularly forgets Sent email folder settings for an account, meaning I have to set the sent folder before I can send emails again, this is quite annoying as it happens on a weekly basis.
I usually leave KMail running, but it seems like every time I log out and back in, sent email folder setting is gone, and I can't send emails before setting it again.

KMail
Version 5.23.2 (23.04.2) on KDE Neon User Edition (up to date)