Bug 230635 - KMail doesn't preserve date when syncing with Gmail
Summary: KMail doesn't preserve date when syncing with Gmail
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.12.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
Depends on:
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


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:

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:

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
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
REVIEW: 113253

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

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