Bug 230635 - KMail doesn't preserve date when syncing with Gmail
Summary: KMail doesn't preserve date when syncing with Gmail
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Unmaintained
Component: general (show other bugs)
Version: 1.12.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-14 00:43 UTC by rfc469
Modified: 2014-02-26 20:55 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rfc469 2010-03-14 00:43:39 UTC
Version:           1.12.4 (using KDE 4.3.5)
Compiler:          gcc version 4.3.4 
OS:                Linux
Installed from:    Gentoo Packages

If I add mail to my imap inbox and sync with Gmail, Gmail displays the sync date (current date) for the mail instead of the date within the mail header.

Likewise if I copy or move mail from one imap inbox to another and sync with Gmail- same thing.

Thunderbird 2 and 3 don't have this problem.
Comment 1 Andy Goossens 2011-04-24 17:18:08 UTC
This issue was discussed on Gmail's help forum:
http://www.google.com/support/forum/p/gmail/thread?tid=6a06469006616870&hl=en

The most interesting comment was from "nicolson":
When uploading messages, the IMAP client is supposed to specify the "internal date" of the message as one of the arguments to the APPEND command. If the client omits this parameter, the server is supposed to use the current time. RFC 3501 section 6.3.11 states in part:

"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."
Comment 2 Suniobo 2013-02-03 08:58:57 UTC
Can confirm the same behavior in Debian GNU/Linux 7.0 (wheezy) KMail Version 1.13.7 Using KDE Development Platform 4.8.4 (4.8.4). And this bug is not about only GMail IMAP implementation so if you have big mail archive  and decide to move it to another mail service with IMAP support via KMail you will get broken letter dates!
Comment 3 Piotr Suwara 2013-02-08 22:18:37 UTC
I confirm it, KDE 4.10.00, Arch Linux, updated today.

This is not only problem with GMail IMAP, but IMAP alone. KMail should send the time it wishes to set as an INTERNALDATE in the APPEND command, as specified in http://tools.ietf.org/html/rfc3501#section-6.3.11 , as Andy wrote before. Now, copying any mails from other mailboxes to an IMAP account results in broken internal dates.

Although this is not seen in KMail, which relies on the message headers, it makes quite a problem when managing copied mails in webclients. Using IMAP one usually expects it to work gladly in both cases.

IMHO the bug is quite annoying, there are some complains about it on the Internet, and still no solution (going through Thunderbird is not a KDE solution): https://www.google.pl/search?q=kmail+gmail+timestamps
Comment 4 Wolfgang Bauer 2013-10-06 13:34:07 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 Wolfgang Bauer 2013-10-15 06:49:43 UTC
I created two review requests to fix this:
https://git.reviewboard.kde.org/r/113253/
https://git.reviewboard.kde.org/r/113254/

They seem to work fine here.

If anyone wants to try these, please do so and report back.
Comment 6 Wolfgang Bauer 2014-02-26 20:17:48 UTC
Git commit 54f46e93daba73b35d7138e8327fc22719e2d612 by Wolfgang Bauer.
Committed on 26/02/2014 at 20:08.
Pushed by wbauer into branch 'master'.

kimap: add methods to set/get the internal date for an APPEND query

This patch adds the methods AppendJob::setInternalDate() and
AppendJob::internalDate().
Those can be used to set the internal date for the APPEND command, see
http://tools.ietf.org/html/rfc3501#section-6.3.11 .

If setInternalDate() is not called, the exact same query is generated as
before, so existing users of AppendJob should not break.

This is needed to fix bug#230635, see
https://git.reviewboard.kde.org/r/113254/
REVIEW: 113253

M  +17   -0    kimap/appendjob.cpp
M  +21   -0    kimap/appendjob.h
M  +14   -3    kimap/tests/appendjobtest.cpp

http://commits.kde.org/kdepimlibs/54f46e93daba73b35d7138e8327fc22719e2d612
Comment 7 Wolfgang Bauer 2014-02-26 20:55:56 UTC
Git commit 0e6716989f3025aa4418d09066fef2863492280a by Wolfgang Bauer.
Committed on 26/02/2014 at 20:47.
Pushed by wbauer into branch 'master'.

imap resource: set the internal date as specified in the mail's header
for an APPEND command

Currently, for an APPEND command there is no internal date specified.
Therefore an IMAP server sets the current date/time for an appended
EMail, see http://tools.ietf.org/html/rfc3501#section-6.3.11 .

While this doesn't matter to KMail (it uses the date/time from the
mail's header anyway), other clients (especially Webmail) may show/sort
by this internal date.

This patch sets the internal date to the date/time as specified in the
mail's header.
FIXED-IN: 4.13
REVIEW: 113254

M  +1    -0    resources/imap/additemtask.cpp

http://commits.kde.org/kdepim-runtime/0e6716989f3025aa4418d09066fef2863492280a