Bug 3237

Summary: incremental saves to drafts fails when expunge immediately is turned off
Product: Claws Mail (GTK 2) Reporter: Dominik Volkamer <mail>
Component: Folders/IMAPAssignee: users
Status: REOPENED ---    
Severity: normal CC: mail
Priority: P3    
Version: 3.10.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Output of `claws-mail --debug` as requested none

Description Dominik Volkamer 2014-07-30 16:55:34 UTC
When I write a new mail, it's auto saved to drafts folder after some time and claws mail displays unread messages in the drafts folder (formerly it didn't display unread messages). When I now open the drafts folder and want to set the unread draft to read status, it didn't work. Claws Mail displays the following error:

"This message can't be displayed. This is probably due to a network error..."

I don't see an IMAP error message in the log.

I asked my mail provider, if there is a problem with the mail server, but he says it looks all fine. The problem occurs both on my PC and laptop under Arch Linux. I tested it with a GIT version from AUR, but I had the same problem.
Comment 1 Dominik Volkamer 2014-07-30 17:01:43 UTC
When I restart Claws Mail, I can open the unread drafts.
Comment 2 Paul 2014-07-30 17:43:34 UTC
Works fine here.

What IMAP server are you using?

You didn't say what happened between the message displaying as unread in the drafts folder and you trying to open it from there. E.g., did you use 'save to drafts folder'?

Are you able to reproduce this?

Do you know if it functioned correctly on the same server previously?

If you can reproduce this, start Claws with `claws-mail --debug` and include the debug output.
Comment 3 Dominik Volkamer 2014-07-30 20:03:54 UTC
(In reply to comment #2)
> What IMAP server are you using?

I'm sorry I don't know at the moment which IMAP server is used by my provider, but I can ask them. Maybe it's dovecot.

> You didn't say what happened between the message displaying as unread in the
> drafts folder and you trying to open it from there. E.g., did you use 'save
> to drafts folder'?

I don't use the save to drafts folder option, but claws mails auto save as draft feature. And I have to say that I don't use the Trash folder, but mark mails only as deleted (and let display also the as deleted marked ones). The described problem occurs only with the drafts claws mails has auto saved and marked as deleted automatically again because there's a newer draft of the same mail.

> Are you able to reproduce this?

Yes, I can. Every time when I open Claws Mail, compose a new mail and write some text in it, the problem occurs. 

> Do you know if it functioned correctly on the same server previously?

Yes it functioned correctly for a long time (but I don't know if my provider changed something at the server). Maybe the problem occurs since the new Claws Mail version 3.10.1, but I can say it for sure.

> If you can reproduce this, start Claws with `claws-mail --debug` and include
> the debug output.

I attached the debug output (in which I removed some personal infos like names of folders).
Comment 4 Dominik Volkamer 2014-07-30 20:05:24 UTC
Created attachment 1418 [details]
Output of `claws-mail --debug` as requested
Comment 5 Paul 2014-07-31 11:20:39 UTC
(In reply to comment #3)
> I don't use the save to drafts folder option, but claws mails auto save as
> draft feature. 

Claws Mail won't auto-save to the drafts folder unless you have configured it to do so. See /Configuration/Preferences/Compose/Writing, 'Automatically save messages to Drafts ....' option.

> And I have to say that I don't use the Trash folder, but mark
> mails only as deleted (and let display also the as deleted marked ones). The
> described problem occurs only with the drafts claws mails has auto saved and
> marked as deleted automatically again because there's a newer draft of the
> same mail.

The problem appears to be that you have auto-save to drafts switched on, but are deleting the draft copy whilst in the middle of writing the message.

If you don't want the message to be auto-drafted, then turn off the option.

If I've misunderstood you, then re-open and explain further. Thanks.
Comment 6 Dominik Volkamer 2014-07-31 12:39:26 UTC
(In reply to comment #5)

> Claws Mail won't auto-save to the drafts folder unless you have configured
> it to do so. See /Configuration/Preferences/Compose/Writing, 'Automatically
> save messages to Drafts ....' option.

Ok, I thought auto-save to the drafts folder is enabled by default, but it seems that I have configured this a while ago. But I like this feature and don't want to set it to disable, because it's very comfortable to have a automatic copy.

> The problem appears to be that you have auto-save to drafts switched on, but
> are deleting the draft copy whilst in the middle of writing the message.

Yes, this might be the problem but I still think this is a bug, because not *I* delete the draft copy manually but Claws Mail does it by itself automatically once a newer version of the copy exisits (and theses mails cause the described error). Formerly I didn't see any unread mail in draft folder. It worked automatically that Claws Mails saved the new composed mail to the draft folder, set the unread flag and deleted the copies once there was a newer version of the copy or I pressed the send button. I liked this behavior because I rarely had to open the draft folder but even so I knew that there are some copies of my composed mail in this folder.
Comment 7 Dominik Volkamer 2014-07-31 13:04:43 UTC
I noticed just now that the described error message is only displayed in the split preview (below the list of messages). When I open one draft copy with the error in a new window it is displayed correctly again. Very strange.
Comment 8 Paul 2014-07-31 13:44:37 UTC
Now I'm confused. So what is the actual problem that you are reporting?
Comment 9 Dominik Volkamer 2014-07-31 23:43:29 UTC
(In reply to comment #8)
> Now I'm confused. So what is the actual problem that you are reporting?

Sorry for confusion. It's a little bit hard to explain, but I try it again.

I now checked if the problem has something to do with my old config folder (.claws-mail). So I made a backup of it and created a whole new config. I discovered that the problem only occurs when the option "Move deleted mails to trash and expunge immediately" is *not* set.

So the steps to reproduce the problem on my systems are:

1. open Claws Mail and click on compose/write new mail 
2. write something in the mail til the autosave feature made for example 3 copies
3. now it shows 3 new unread messages in draft folder, even though they are marked already as deleted by claws mail itself (formerly claws mail didn't show new unread messages in draft folder and this is the behavior I prefered)
4. send the mail

And after that steps it disturbs me that I have new unread messages in draft folder. So

5. I change to drafts folder and select one of the unread already marked as deleted mail and want the status set to read (which is normally done when the mail is shown in the preview under the message list) but in the preview it says:

"This message can't be displayed. This is probably due to a network error..."

And now there are three workaround options:

- press Ctrl + E to expunge in the draft folder
- open all three (already deleted) copys in a new window
- restart claws mail

I hope you now understand what's the problem and maybe even can reproduce it.
Comment 10 Paul 2014-08-01 07:24:43 UTC
Thanks. I now understand what the problem is and can reproduce it.

In the meantime, you can turn off incremental saves to drafts or turn on expunge immediately, or in the account advanced preferences, specify a Drafts folder in an MH mailbox (creating the mailbox if necessary).
Comment 11 Dominik Volkamer 2014-08-01 14:14:24 UTC
(In reply to comment #10)
> Thanks. I now understand what the problem is and can reproduce it.

I thank you for your quick help.

> In the meantime, you can turn off incremental saves to drafts or turn on
> expunge immediately, or in the account advanced preferences, specify a
> Drafts folder in an MH mailbox (creating the mailbox if necessary).

Sorry but my Claws Mail is set to German, so what exactly do you mean with "incremental saves to drafts"? Do you mean I should turn off the option "Automatically save message to drafts folder every n characters'. (/Configuration/Preferences/Compose/Writing)?
Comment 12 Michael Schwendt 2015-02-10 12:00:44 UTC
Paul, could you give a hint what the problem is?

Red Hat bug 1182841 for Fedora 21 Claws Mail 3.11.1 reports that with auto-saving of drafts and immediate expunge enabled, sometimes a message in drafts folder is not deleted when sending the mail.