Bug 292622 - moved mails reappearing in sent mail folder
Summary: moved mails reappearing in sent mail folder
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: folders (show other bugs)
Version: 1.99.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-27 18:42 UTC by Dr. Christoph Pospiech
Modified: 2012-03-03 21:14 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. Christoph Pospiech 2012-01-27 18:42:55 UTC
Version:           1.99.0 (using KDE 4.7.4) 
OS:                Linux

After sending a mail, I usually move it to a different folder. In particular, I delete it from the sent-mail folder. After sending the next mail and opening the sent-mail folder, the deleted mail reappears in the sent-mail folder. It is a duplicate of the mail that was moved. Deleting the duplicate copy from the sent mail folder appears to remove it permanently.

Reproducible: Sometimes

Steps to Reproduce:
1. send a mail
2. move mail from sent-mail to another folder
3. send another mail
4. close sent-mail folder (i.e. open another folder)
5. close kmail2, open it again
6. open sent-mail folder
Not quite sure whether steps 4.+5. are actually necessary,
but it helped me to reproduce the error more often.
Step 6 is necessary, the mail count in sent-mail is increasing 
when opening the sent-mail folder, i.e. the mails only reappear
when you look at them (reminds me faintly of Schroedingers cat...).

Actual Results:  
Mails that had been moved to another folder (and deleted from sent-mail) reappear in the folder and have to be deleted a second time.

Expected Results:  
Mails that are moved away should stay out of the folder.

OS: Linux (i686) release 3.0.0-15-generic
Compiler: gcc
Comment 1 Laurent Montel 2012-01-30 07:53:56 UTC
imap ? (trash is in an imap account) ?
you move how ? (in composer editor you select a specific folder ? )
Comment 2 Dr. Christoph Pospiech 2012-01-30 08:45:18 UTC
Thanks for asking.

I don't use imap. Hence trash is local.

I move mails by dragging them with them mouse from the folder contents list (kmail2 sub window in the top right) for sent-mail and dropping them onto one folder in the kmail2 sub window in the lower left. When I do this, a window pops up asking me whether to copy or to move and I click on "move". At this moment I see the number of mails in the sent-mail basket decremented by one and the number of mails in the target folder incremented by one - as expected. Only after sending another mail, when doing this again, the moved mails reappear when opening the sent-mail folder.
Comment 3 Silver Salonen 2012-01-31 08:02:00 UTC
In my case it happens with Inbox - I've waited long enough for KMail to start etc (otherwise it hanged too much to use it anyway), but when I click "Move to trash" button, message is grayed out for some seconds and then it'd normal again, not having been moved.
Comment 4 Silver Salonen 2012-01-31 08:04:12 UTC
Hmm, interesting. Some time after (next sync maybe) the messages disappeared from Inbox, so I guess actually they were moved, but message list was not updated properly?

BTW, I use IMAP account.
Comment 5 Dr. Christoph Pospiech 2012-02-07 17:06:56 UTC
Hi I just posted a question about the correct akonadi configuration in
http://forum.kde.org/viewtopic.php?f=215&t=99000 . Could it be that this bug is
related with this question ?

Christoph Pospiech
Comment 6 Dr. Christoph Pospiech 2012-02-09 07:28:24 UTC
I just noted that kmail2 is currently not showing a mail in the sent-mail folder, but there is a mail in /home/cp/.local/share/.local-mail.directory/sent-mail/cur/ . Having seen that, I sent another mail (subject test-mail, content test). kmail2 first showed 1 mail in sent-mail folder, /home/cp/.local/share/.local-mail.directory/sent-mail/cur/ contained two files. Then I opened the sent-mail folder and it still displayed only the new test mail. Only after closing and restarting kmail, both mails were shown in kmail2.

Perhaps that sheds some light on how the mails reappear.

Christoph Pospiech
Comment 7 András Manţia 2012-02-11 22:47:51 UTC
What is your local folder type? Check with "akonadiconsole" app, Agents tab, click on the account and in the details look at "Type".
Comment 8 Dr. Christoph Pospiech 2012-02-12 17:32:16 UTC
Hi, it appears that my Local Folder structure is almost empty (just inbox, trash, outbox, sent-mail and such, no stored mails). So my akonadi set up looks corrupted. See https://bugs.kde.org/show_bug.cgi?id=290589 for details.

Christoph Pospiech
Comment 9 Dr. Christoph Pospiech 2012-03-03 21:14:28 UTC
Hi,

apparently, I solved the problem.

For some reason (yet unknown) the sub directories in local-mail got lost. I could be that I myself deleted them early after migration. Then kmail2 apparently stores everything in cache as it cannnot store it in local-mail.

Moving a message from sent-mail elsewhere was not possible, als the folder actually dod not exist. Perhaps that is why it reappeared in sent-mail.

I wrote a perl script with DBI::mysql API that extracts the local-mail directory structure from the aconadi data base and recreates it. It also reads the emails in akonadi cache (aka data field in parttable from database akonadi) and moves the emails to their proper place in local-mail.

After running the script, I re-created the akonadi data base. kmail2 now runs smoothly and sent-mails don't re-appear again. I just reran the steps outlined in the error description.

Christoph Pospiech