When an email status changes from read to unread on the server side, this status change is never applied to akonadi storage (i.e., the mail is still in read status). I have done a manual folder update (f5) and restarted akonadi, but both action did have no effect. I have checked this in akonadiconsole (mail is still flagged "\SEEN"). Thus this is not a kmail bug. The bug was tested and reproduced on three different akonadi installations (gentoo) with the same imap server. The status gets synced correctly with other mail clients such as thunderbird and k9-mail. The bug is always reproducible.
Confirmed. I marked a read message to unread in K9 Mail, and tried to convince KMail of the updated state by reloading the folder, restarting Kontact, akonadictl restart. K9 Mail as well as the webmailer still show it as unread, so the state wasn't reset automatically to read by Akonadi. Even if I move the mail to another folder in KMail, it still shows the message as read, while K9 Mail and the webmailer show it as unread. KDE Applications 16.12.1, Frameworks 5.30.
*** Bug 358313 has been marked as a duplicate of this bug. ***
Git commit e49f49a1eb616b51c2286853961fe5bcaa4fe758 by Daniel Vrátil. Committed on 19/04/2017 at 00:30. Pushed by dvratil into branch 'Applications/17.04'. Fix clearing Item flags For instance when an email is marked as unread on an IMAP server, it means that the \\SEEN flag is removed. If this was the only flag set on the email, then Akonadi::ItemSync will end up calling Akonadi::Item::setFlags() with an empty QSet. When the AKAPPEND handler is in the MERGE mode and runs into an empty Flags field in the CreateItemCommand it fallsback to checking AddedFlags and RemovedFlags fields, but those are empty too. Akonadi::Item internally tracks when setFlags() is called, even with an empty QSet through flagsOverwritten flag. With this change the flag is sent as part of the command to the server and the AKAPPEND handler now falls back to AddedFlags/RemovedFlags fields only if the flag is false. This fixes syncing email flags when email state changes from read to unread on IMAP, but due to how IMAP emails are synced this will only affect future changes and will not sync existing out-of-sync emails. FIXED-IN: 5.5.1 M +3 -1 autotests/private/protocoltest.cpp M +4 -1 src/core/jobs/itemcreatejob.cpp M +21 -4 src/private/protocol.cpp M +2 -0 src/private/protocol_p.h M +1 -1 src/server/handler/akappend.cpp https://commits.kde.org/akonadi/e49f49a1eb616b51c2286853961fe5bcaa4fe758