https://bugs.kde.org/show_bug.cgi?id=417206
Bug ID: 417206 Summary: KMail wrong date in IMAP APPEND command Product: kmail2 Version: 5.12.3 Platform: Gentoo Packages OS: Linux Status: REPORTED Severity: minor Priority: NOR Component: commands and actions Assignee: kdepim-b...@kde.org Reporter: vic.m.iva...@gmail.com Target Milestone: --- SUMMARY When copying an email from one account's folder (e.g. Inbox) to another account's folder (e.g. Inbox again) the wrong email date is supplied in the IMAP APPEND command. At present, KMail provides the current date/time string. This is contrary to RFC 3501 section 6.3.11 which states: If a date-time is specified, the internal date SHOULD be set in the resulting message; otherwise, the internal date of the resulting message is set to the current date and time by default suggesting that, if possible, the message's internal date/time string should take precedence. STEPS TO REPRODUCE 1. Enable logging: "$ export KIMAP_LOGFILE=$HOME/kimap/kimap.log" 2. Copy (e.g. old) email from a folder in account A to a folder in account B 3. Observe logged IMAP communication, notably the APPEND command as logged OBSERVED RESULT For an email with internal date (i.e. has "Date" header) of "01-Jan-2010 12:34:56 +0000" the APPEND command, as logged, looks something like: C: A000004 APPEND "INBOX" (\Seen) "05-Feb-2020 10:20:30 +0000" {104666} where the timestamp of the IMAP command is the time that the command was submitted to the mail server, followed by the email source. EXPECTED RESULT The correct APPEND command under said conditions should instead look something like: C: A000004 APPEND "INBOX" (\Seen) "01-Jan-2010 12:34:56 +0000" {104666} since "01-Jan-2010 12:34:56 +0000" is the internal date available in the message headers. SOFTWARE/OS VERSIONS KMail Version: 5.12.3 Linux/KDE Plasma: Gentoo Linux KDE Plasma Version: 5.17.4 KDE Frameworks Version: 5.64.0 Qt Version: 5.13.2 also present in: KMail Version: 5.12.3 Linux/KDE Plasma: Debian Testing KDE Plasma Version: 5.14.5 KDE Frameworks Version: 5.62.0 Qt Version: 5.12.5 ADDITIONAL INFORMATION The above issue appears to affect multi-part messages such as those containing HTML as well as PGP encrypted messages. As far as I could tell, it does not seem to affect plain text messages, though it may need further verification. WHY IS THIS A PROBLEM Most mail clients (including KMail) will show the timestamp of the internal Date header. However, some web-based clients (such as GMail, as a popular example) store and index messages based on the timestamp provided as per the IMAP APPEND command. This can make migrated email messages show up with incorrect timestamps an in the wrong order which can also mess up with conversation view grouping. Another problem is if KMail's message filtering is used to automatically PGP encrypt incoming messages which are IMAP APPEND-ed post-encryption to the mail server, thereby resulting in the same problem as with migrated emails. In contrast, other mail clients (e.g. Thunderbird) will use the internal timestamp in every case, as per the RFC. -- You are receiving this mail because: You are watching all bug changes.