Bug 185415 - Changing server address leads to redownload of mail
Summary: Changing server address leads to redownload of mail
Status: RESOLVED INTENTIONAL
Alias: None
Product: kmail
Classification: Unmaintained
Component: general (show other bugs)
Version: 1.10.3
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-24 08:57 UTC by Jean-Pierre Viljoen
Modified: 2011-12-04 18:45 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Pierre Viljoen 2009-02-24 08:57:38 UTC
Version:           1.10.3 (using 4.1.3 (KDE 4.1.3), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.27-9-generic

Description: When a POP3 mail account is configured to leave mail on the server after downloading (2 or 3 weeks, in my case, but I do not think setting a time limit would make a difference with the bug in question), and you subsequently change the server address at some point in time, it leads to KMail redownloading all mail in the mailbox.

How to reproduce:
1) Set up a POP3 mail account configured to leave mail on the server.
2) Check mail and wait for download.
3) Go to account settings and change server address.
4) Check mail again, and see old mail being duplicated.

Expected behaviour:
Not redownloading already-existing email.
Comment 1 Jaime Torres 2009-03-01 00:08:36 UTC
According to rfc5322, I guess you are right,
but reading:
http://cr.yp.to/immhf/thread.html
I guess kmail does the right thing (to prevent easily forging a message with a duplicate Message-ID from another pop server).

Could this be the root cause of the mail duplicating problem? (for example, an IP change or dns mx change of the mail server?)
Comment 2 Torgny Nyblom 2009-11-06 20:17:01 UTC
Unless I'm very wrong here mail clients (including KMail) do not use the message-id to determine if it should download a message from a pop server or not since this is part of the message. Instead they use the UIDL function to retrieve a list of message ids that are on the server. This number is specific to each server and hence the local cache will be invalid when the server changes.

For your specific case to work the change needed would make all users who use pop and "leave mail on server" functionality download the headers and the first 10 lines of each message on the server on every mail check.

With this in mind I'm closing this as wontfix.
Comment 3 Thomas McGuire 2009-11-06 20:31:00 UTC
Reopening this.
This has nothing to do with the message id.

The cause of this bug is that KMail saves the list of UIDs of mails which it has downloaded from the server, but not deleted, in a file which contains the host as part of the filename. If the host is changed, it can't read the old UID list anymore, and therefore doesn't know which mails were already downloaded.

(BTW, this is changed for the Akonadi POP3 resource, there the UID list is in the general config file, therefore changing the host will not cause problems)
Comment 4 Torgny Nyblom 2009-11-07 09:04:25 UTC
How can Kmail and Akonadi be sure that the UIDs are valid when the host changes (they are host specific)?
It seems to me like this new behavior is a way for a new bug "changing host ignores some messages".
Comment 5 Thomas McGuire 2009-11-07 14:25:25 UTC
> It seems to me like this new behavior is a way for a new bug "changing host
> ignores some messages".

True, I didn't think of that. One can hope that the UIDs are sufficiently different on the two servers, but that is not the real solution.
Comment 6 Torgny Nyblom 2011-12-04 18:45:54 UTC
Closing as the RFC states that a UIDL is only valid within a maildrop and while a message that has a certain UIDL exists in that maildrop.