The compose window saves multiple drafts per message in the Gmail Drafts IMAP folder

NEW
Unassigned

Status

Thunderbird
Message Compose Window
8 years ago
21 days ago

People

(Reporter: Ehsan, Unassigned)

Tracking

(Blocks: 2 bugs)

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [can provide more info if needed])

When I'm typing an email, on each interval that a draft message should be written to the drafts folder, Thunderbird creates a new draft in my Gmail Drafts IMAP folder.  Also, when I send the message, it doesn't delete any of those messages, so I have to go through my Drafts folder on Gmail and delete each draft from time to time.

Comment 1

8 years ago
Ehsan, what is your save interval set to?
As Gmail IMAP doesn't remove mail data from [Gmail]/All Mail when \Deleted flag is stored at a folder(Gmail Label), Gmail does special action on mail flagged \Draft. Gmail/Gmail IMAP moves mail flagged as \Deleted & \Draft to [Gmail]/Trash in order to remove the mail from [Gmail]/All Mail and to erase it permanently.
See bug 562748. I checked it on 2010-05-01, so I don't know current behavior.

If old version of draft mail is not removed, it may be next phenomenon.
 Tb uses "search by message-ID" for old version of draft, and store \Deleted
 to the old version. If search doesn't return result, Tb can't store \Deleted.
Because Gmail does do special actions internally as seen in Bug 562767, UID for different data may be returned to search.
It may be delay in propagation of mail status from [Gmail]/All Mail to [Gmail]/Drafts.

Can you get IMAP log and check IMAP level flow?
Show "Order Received" column(UID of mail if IMAP) for ease of log analysis.
If you use IMAP delete model of "Just mark as deleted", phenomenon may become clearer.
Do you compose/save draft while Work Offline mode?
In quick check of "Save as draft * N times whle Offline" and "Back to Work Online" with Tb 3.1.6 on Win, I could observe multiple draft mails in Drafts.
As some issues aroun sleep/wake up on Mac are reported, it may be issue relevant to sleep/wake up and offline/online detection.
Was "sent mail copy to IMAP Sent" succesfull?
(Reporter)

Comment 4

8 years ago
No, this happens in online mode.  The save interval is set to whatever default value it is, but I don't see how that is important.

This should be 100% reproducible, and any developer should be able to investigate.
(In reply to comment #4)
> This should be 100% reproducible, (snip)

My questions imply; It's impossible to see phenomenon you stated in my environment unless forcing draft save while Work Offline. If online mode, \Deleted is always stored to old version of draft, and the old version is always moved to [Gmail]/Trash by Gmail.

Can you describe about detailed phenomenon or your environment?
What folder view do you use? All Folders? Unified Folders?   
(I'm talking about Tb's drafts folder at All Folders view)   
When you see multiple drafts, what mails are seen in [Gmail]/Trash?
(check at All Folders view of other Tb window opened via "Open" of context menu of account/folder, and open other folder then click [Gmail]/Trash.)
What number is shown at Order Received column? (UID of mail)
"uid xxx store +flag (\Deleted)" is seen in IMAP log? No such log relates to "delete of old version"? 
If you enable "Show confirmation dialog ..." at Copies&Folders, you can see dialog of "drafts is saved", and after OK reply to it, you will see newly saved draft mail at thread pane of drafts folder of Tb. So, you can see "when draft is saved by auto-save".
I've seen this sort of issue on my courier based IMAP account, it has been highlighted since we've turned on saving drafts as unread for IMAP accounts on trunk. I can definitely reproduce on trunk.

For my case the general route of events are:

- Start writing an email with the drafts folder selected
- let it auto-save
- Drafts folder count doesn't get increased or refreshed.
- Enter some more text and wait for another auto-save.
- Again, drafts folder count doesn't get increased.
- Exit and re-enter the drafts folder.
- Drafts folder shows 2 messages not 1.
- Send email
- Drafts folder still has 1 message remaining.
status-thunderbird5.0: --- → ?
(In reply to comment #6)
> courier based IMAP account, (snip)

UIDPLUS and MULTIAPPEND is supported by your Courier IMAP server?
Bug 400043 is for; a) wrong response from server -> b) Tb uses wrong UID for delete -> c) wrong draft mail is deleted. If b) is "Tb can't know UID" and c) is "Tb doesn't request delete(doesn't fall back to search by message-id)", phenomenon of "draft remains" can happen.
As Gmail IMAP doesn't support both extensions, such phenomenon can't happen with Gmail IMAP. 

> I can definitely reproduce on trunk.

Mark Banner, can you get IMAP log and check IMAP level flow?
(Reporter)

Comment 8

8 years ago
Mark, I see this on 3.1 nightlies...
Checked with Tb 3.1.7, Online mode only, "Just mark it as deleted" model, IDLE command use disaled, automatic new mail check disabled, and, Drafts at Unified Folders view.
Two versions of draft mail, newest version and previous version, was always observed. Older version disappeared automatically, because Tb knew "it was expunged" during "storing of \Deleted flag to previous version", so, it was always "two versions".

Previous version is shown as deleted(with strike line) at Drafts of All Folders view when "Just mark it as deleted" model. As the deleted mail(previous version) is already moved to [Gmail]/Trash, and as Gmail automatically expunges deleted mail(\Deleted flag is stored) unless user disables auto-expunge by avanced feature of Gmail Lab, deleted previous version(with strike line) automatically disappears by notification via IDLE or next folder open at All Folders view(or each account shown under Drafts of Unified Folders view).
"Two versions of draft mail at Drafts of Unified Folders view" was not observed with "Remove immediately" model.

Stlike line is shown as expected if Saved search folder.
Stlike line is shown as expected at each account under Drafts of Unified Folders view.
Unified Folder doesn't seem to support display of deleted mail by "Just mark it as deleted" model.

Ehsan Akhgari(bug opener), do you use Unifiled Folders view with "Just mark it as deleted" model?
Which do you mean by "multiple drafts" in you bug summary of "multiple drafts per message in the Gmail Drafts IMAP folder"?
  a) mail data really held in [Gmail]/Drafts at server(==Drafts at Gmail Web) 
  b) Tb's display at thread pane or message pane
  c) both of a) & b)
Do you use "Advanced IMAP Controls" of Gmail's Labs and disable automatic-expunging?
(Reporter)

Comment 10

8 years ago
(In reply to comment #9)
> Ehsan Akhgari(bug opener), do you use Unifiled Folders view

Yes.

> with "Just mark it
> as deleted" model?

I don't know!

> Which do you mean by "multiple drafts" in you bug summary of "multiple drafts
> per message in the Gmail Drafts IMAP folder"?
>   a) mail data really held in [Gmail]/Drafts at server(==Drafts at Gmail Web) 
>   b) Tb's display at thread pane or message pane
>   c) both of a) & b)

I don't really know how to look at the mail data stored on the gmail server.  What I mean is that I see multiple copies of my message, each at various stages of being composed, stored in the drafts folder, both on the gmail web interface and in Thunderbird.

> Do you use "Advanced IMAP Controls" of Gmail's Labs and disable
> automatic-expunging?

I do, yes.
(In reply to comment #10)
> > with "Just mark it as deleted" model?
> I don't know!

Account Settings/Server Settings, "When I delete a message:".

> I don't really know how to look at the mail data stored on the gmail server. 
> (snip) stored in the drafts folder, both on the gmail web interface and in Thunderbird.

If mail is shown in Drafts at Gmail Web Interface, it's evidence that mail exists in Gmail's folder and evidence that the mail is not moved to Trash([Gmail]/Trash for Tb) or Spam([Gmail]/Spam for Tb). It's sometimes evidence that \Deleted flag is not stored by Thunderbird yet. However, Gmail Web interface shows mails as conversation(same as thread of Tb) instead of each mail. As draft mails usually have same subject, they are shown as single conversation. A mail flagged as \Deleted by IMAP client is not excluded from display of the conversation, unless the mail is moved to [Gmail]/Trash or [Gmail]/Spam. So, next is needed to see previous version is deleted by Tb or not via Gmail Web interface, if auto-expunging is enabled.
  - Change subject upon each draft save.
If auto-expunging is disabled, it's hard to know "\Deleted flag is stored or not" via Gail Web interface.
In any case, easiest way is to see IMAP folder content using other IMAP client including Tb, with "Just mark it as deleted" model. "Using same Tb instance" is possible, if second IMAP account of same server/same userid is defined with IP address insted of server name.

Did you check IMAP log? (evidence that Tb stored \Deleted flag)
Did you check [Gmail]/Trash content?
If draft mail of previous version is moved to Trash, it's shown in [Gmail]/Trash of Thunderbird. I think previous version was not moved to [Gmail]/Trash in your case, because you disable auto-expunging.

> > do you use Unifiled Folders view
> Yes
> > Do you use "Advanced IMAP Controls" of Gmail's Labs and disable automatic-expunging?
> I do, yes.

Can you reproduce your problem with automatic-expunging enabled?
Please check with both "Remove it immediately" model and "Just mark it as deleted" model.
My check was with "automatic-expunging enabled"(default) + "Just mark it as deleted" model/"Remove imediately" model.

Comment 12

8 years ago
(In reply to comment #7)
> (In reply to comment #6)
> > courier based IMAP account, (snip)
> 
> UIDPLUS and MULTIAPPEND is supported by your Courier IMAP server?
> Bug 400043 is for; a) wrong response from server -> b) Tb uses wrong UID for
> delete -> c) wrong draft mail is deleted. If b) is "Tb can't know UID" and c)
> is "Tb doesn't request delete(doesn't fall back to search by message-id)",
> phenomenon of "draft remains" can happen.
> As Gmail IMAP doesn't support both extensions, such phenomenon can't happen
> with Gmail IMAP. 

i see this too with Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b9pre) Gecko/20101229 Thunderbird/3.3a2pre

courier says:
>  A0002 CAPABILITY
> * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION
A0002 OK CAPABILITY completed

i don't know if bug #400043 applies to me or not.
David (Bienvenu) said he couldn't reproduce this, so I suspect more STRs may be needed.
status-thunderbird5.0: ? → ---
Keywords: qawanted

Comment 14

7 years ago
this is working for me with my gmail account on Windows. Perhaps something has changed on the gmail side?

Comment 15

7 years ago
(In reply to comment #12)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > courier based IMAP account, (snip)
> > 
> > UIDPLUS and MULTIAPPEND is supported by your Courier IMAP server?
> > Bug 400043 is for; a) wrong response from server -> b) Tb uses wrong UID for
> > delete -> c) wrong draft mail is deleted. If b) is "Tb can't know UID" and c)
> > is "Tb doesn't request delete(doesn't fall back to search by message-id)",
> > phenomenon of "draft remains" can happen.
> > As Gmail IMAP doesn't support both extensions, such phenomenon can't happen
> > with Gmail IMAP. 
> 
> i see this too with Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b9pre)
> Gecko/20101229 Thunderbird/3.3a2pre
> 
> courier says:
> >  A0002 CAPABILITY
> > * CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION
> A0002 OK CAPABILITY completed
> 
> i don't know if bug #400043 applies to me or not.

regarding my comment/report,i can only say that it currently wfm.
no change to my imap server setup!
This is also WFM.

Comment 17

7 years ago
Note: generally, deletion issues for draft messages don't happen to all people - steps which fail for one person can work for someone else. Perhaps the gmail case is/was more easily reproduced?


additional reports:
Bug 540047 - [GMail] Sending a draft doesn't remove the draft, saving a draft duplicates it
Bug 482836 - Multiple (iterations) copies of draft messages are saved in the DRAFTS folder (local Drafts folder, not IMAP)
Bug 460085 - snapshots of composed emails save as separate messages in IMAP drafts folder - multiple drafts
Bug 549274 - Drafts not deleted on IMAP after message has been sent
(Reporter)

Comment 18

7 years ago
FWIW, I'm still seeing this with the STR in comment 0.  Every single time.
(In reply to comment #18)
> I'm still seeing this with the STR in comment 0.  Every single time.

If so, why "check result of IMAP log" or "IMAP log data itself" is not provided yet by you? You still need link like next in your bug by other people?
> https://wiki.mozilla.org/MailNews:Logging
> Win example : SET NSPR_LOG_MODULES=timestamp,imap:5
(I thought you already know how to get log...) 

Ehsan Akhgari(bug opener), can you attach IMAP log file to this bug, with auto-expunging disabled(your specific case), after replace/delete sensitive information and remove irrelevant data such as mail data except Message-Id: header?
As seen in bug 562748, Gmail's treatment of mail flagged \Draft is special. It may be conflict with "auto-expunging=off" by "Advanced IMAP Controls" which supports \Deleted flag of a deleted mail in an IMAP folder(==Gmail Label).
(Reporter)

Comment 20

7 years ago
Going to Gmail's settings page, "Forwarding and POP/IMAP" tab, and selecting "Immediately expunge messages when I mark them deleted in IMAP" in the "Auto-Expunge" section seems to resolve this issue.


(In reply to comment #19)
> (In reply to comment #18)
> > I'm still seeing this with the STR in comment 0.  Every single time.
> 
> If so, why "check result of IMAP log" or "IMAP log data itself" is not provided
> yet by you? You still need link like next in your bug by other people?
> > https://wiki.mozilla.org/MailNews:Logging
> > Win example : SET NSPR_LOG_MODULES=timestamp,imap:5
> (I thought you already know how to get log...) 

I have not provided the IMAP log yet because I missed it in your lengthy reply to my comment 10.  And my experience in other Thunderbird bugs that I've filed shows me that if somebody is interested in fixing the bug, they know how to find me on IRC, and get more information from me if they need it.

I'm trying to help here, but I'm human and I sometimes miss things in a comment, and I'm not sure that I appreciate your tone here at all.

Comment 21

7 years ago
(In reply to comment #20)
> Going to Gmail's settings page, "Forwarding and POP/IMAP" tab, and selecting
> "Immediately expunge messages when I mark them deleted in IMAP" in the
> "Auto-Expunge" section seems to resolve this issue.
> 
I could be wrong, but I think you turned off that setting because of a different issue. I believe having it turned on is the gmail default.
(Reporter)

Comment 22

7 years ago
(In reply to comment #21)
> (In reply to comment #20)
> > Going to Gmail's settings page, "Forwarding and POP/IMAP" tab, and selecting
> > "Immediately expunge messages when I mark them deleted in IMAP" in the
> > "Auto-Expunge" section seems to resolve this issue.
> > 
> I could be wrong, but I think you turned off that setting because of a
> different issue. I believe having it turned on is the gmail default.

So does this mean that I'm going to see the other issue (which I don't remember what it was) again?  And is this a bug in Thunderbird or in Gmail's IMAP handling?

Comment 23

7 years ago
(In reply to comment #22)
> 
> So does this mean that I'm going to see the other issue (which I don't remember
> what it was) again?  And is this a bug in Thunderbird or in Gmail's IMAP
> handling?

I don't remember what the other issue was so I can't say.
As for Gmail Label of [Imap]/Drafts(==root level Drafts folder via IMAP), Gmail and Gmail IMAP worked as designed, as expected, based on definitions by protocol named IMAP, with any of Advanced IMAP Controls=Off(auto-expunging=on always), Advanced IMAP Controls=On/auto-expunging=on, and Advanced IMAP Controls=On/auto-expunging=off.

No answer about folder View and IMAP delete model in his environment from bug opener...
To bug opeer, are you looking bug 635869?
(Drafts of Consolidated Folders is a Virtual folder internally, and search target folders is mixture of local mail folders and IMAP folders)
Oh typo, which is worse than lengthy comment, which will surely cause vanishing of my question.
Correct my question is next, sorry for typo;
(I hope I don't need to ask at IRC and this comment is not so lengthy)

To bug opener, are you looking bug 635869?
(Reporter)

Comment 26

7 years ago
(In reply to comment #25)
> Oh typo, which is worse than lengthy comment, which will surely cause vanishing
> of my question.
> Correct my question is next, sorry for typo;
> (I hope I don't need to ask at IRC and this comment is not so lengthy)
> 
> To bug opener, are you looking bug 635869?

Bug 635869 comment 0 sees very different to me.  These may both be the same problem, but someone who knows IMAP and has investigated both issues should make that call.
To bug opener:
This comment is very lengthy and I "what wanted to know" is placed at bottom of comment, but read through, please.

(In reply to comment #26)
> > To bug opener, are you looking bug 635869?
> Bug 635869 comment 0 sees very different to me.

Sorry but I didn't ask to bug opener of this bug about "what your feel about the comment number ZERO of that bug".

As we wrote in that bug, we saw phenomenon of "already deleted mail in IMAP folder(flagged as \Deleted) is not shown as deleted in saved search folder".
This looks "deleted mail is not deleted" for general user's eyes.
And we found conditions when the phenomenon occurs. This is written in some places in that bug but is currently written in Bug 635869 comment #12. It's never in Bug 635869 comment #0.
And, (a) if IMAP folder and \Deleted flag is normally stored to a mail, and (b) IMAP delete model of "Just mark it as deleted", and (c) if Virtual Folder is used and IMAP folder is included in search target folder of the Virtual Folder, and (d) if other than IMAP folder is included in search target folder of the Virtual Folder, phenomenon of Bug 635869 occurs when some other conditions exist.

Please note that next;
(i) Conditions I stated in above (a) to (d) are absolutely irrelevant to protocol named IMAP except condition of (a).
(ii) If IMAP, Tb stores \Deleted flag to a mail when mail is deleted, and "delete of old version of draft upon new draft save" is also a "delete of a mail" and Tb stores \Deleted flag.
(iii) In my check, I couldn't see "Tb doesn't store \Deleted flag upon delete of old version of draft mail", with root level Drafts folder(==[Imap]/Drafts via IMAP), even with aoto-expunging=off by Advanced IMAP Controls of Gmail Lab.
(iv) As I wrote before, Consolidated Folders is implemented using "Virtual Folder" internallly.
(v) Search target folders of a "Consolidated Folder" is usually mixture of local mail folder and IMAP folder" if IMAP account is defined, because "Local Folders" account is always created by Tb.
(vi) "Drafts" folder at "Consolidated Folders" view is a "Consolidated Folder" in above (v).

I wanted to ask next to bug opener of this bug by my previous question.
  Are there all conditions which needed to produce Bug 635869
  in your environment when you reported comment #0 and comment #18?
It's to rule out problem of Bug 635869 in this bug, because Bug 635869 looks "deleted mail is not deleted" for general user.
Please note that next;
- You rejected to check IMAP log or to provide IMAP log data.
  So, we can't know whether Tb stored \Deleted flag to old version of draft
  mail or not in your environment when problem of comment #0 and comment #18
  occurred in your environment.
- You rejected to answer about your "IMAP delete model" choice.
  So, we can't know whether "Just mark it as deleted" model is used or not
  in your environment.
- You rejected to answer about "Consolidated Folders view is used or not".
  So, we can't know whether "Virtual Folder" is relevant to this bug or not.
(Reporter)

Comment 28

7 years ago
WADA, please note that you are asking me questions that I do not know how to answer.

(a) I don't know if the \Deleted flag is normally stored to a mail.  
(b) I believe we already know that this condition is a determining factor here.
(c) I don't know if I'm using a "Virtual folder".  I don't even know what Virtual Folders are.  This is happening to me in the Drafts folder?  And anybody with a gmail account can answer this question.
(d) "if other than IMAP folder is included in search target folder of the Virtual Folder, phenomenon of Bug 635869 occurs when some other conditions exist."  I can't even parse this sentence, and I don't know what the answer is.

About generating IMAP logs, I'd go ahead and do that if I got the impression from a Thunderbird developer that they're willing to spend time in debugging this, and that they can't reproduce this with the automatic expunge setting in gmail.  So far, I've neither received confirmation that anybody is willing to debug and fix this, not have I seen any evidence which suggests that there is something very special about my gmail account that would make others unable to reproduce this problem.

The amount of time I spend on any bug is directly dependent on the amount of help that I can bring to the table.  If a Thunderbird developer who wants to debug this tells me that they need the log, I'd generate it for them.  I understand that you're trying to help, but please don't take it personal if I tend to spend my time in other bugs until I see some activity here.  Also, in the future try to be a bit more kind to bug reporters.  I'm not new around the Mozilla project, but I'm afraid that your tone would cause first time bug reporters to be discouraged from continuing their contribution to the Mozilla project.  With that, I will end this series of comments waiting for a Thunderbird developer to chime in.  :-)
Sorry but I'm not developer. I'm merely a helper of QA peoples to help problem analysis by QA peoples and developers.

(In reply to comment #28)
> WADA, please note that you are asking me questions that I do not know how to answer.

I already notified you for it at least about "IMAP delete model" in comment #11.
> > (In reply to comment #10)
> > > with "Just mark it as deleted" model?
> > I don't know!
> Account Settings/Server Settings, "When I delete a message:".

If "Just mark it as deleted" is not selected at the setting, "Just mark it as deleted" is not used in your environment, because option setting by UI at "When I delete a message:" is implemented as "radio button".
If this option is not selected, Bug 635869 doesn't occur, because this option choice is a mandatory condition of Bug 635869.
(In other words, if "Just mark it as deleted" is not used, Bug 635869 doesn't occur.)

If auto-expunging=On, Gmail IMAP removes mail flagged as \Deleted sooner or later(do EXPUNGE operation for the mail only), and Tb knows about the EXPUNGE operation(UID of mail which Tb marked as \Deleted disappears from folder) sooner or later. When Tb knows the EXPUNGE operation, Tb removes mail data of the UID from mail box, because the UID doesn't exist any more in mail folder(real mail folder which is shown at "All Folders" view at folder pane). Because mail of the UID doesn't exist any more, the mail is removed from a saved search folder, or a folder at "Consolidated Folders" view.
So, if auto-expunging=On, Bug 635869 can not be observed usually. 
 
On the other hand, if auto-expunging=Off, Gmail IMAP keeps mail flagged as \Deleted in an IMAP folder(==Gmail Label). i.e. Gmail IMAP behaves as if he is normal/ordinal IMAP server, as for \Deleted flag of a mail.
So, Bug 635869 always happens even with Gmail IMAP, if all conditions are met.  

You reported next.
  - You enable "Advanced IMAP Controls" Labs and disable automatic-expunging.
  - Problem of comment #0 really occurred.
  - Problem of comment #0 still occurs really(comment #18).
  - If automatic-expunging is enabled, problem of comment #0 disappears.
When I asked questions before Bug 635869 is opened, I didn't know problem of Bug 635869. However, I saw some funny phenomena with "Consolidated Folders" view, so I asked you about your usage of "Consolidated Folders" view.
After analysis of Bug 635869, I'm sure that problem of Bug 635869 can be explained by Bug 635869 comment #12.

So, "Just mark it as deleted is not used in your environment" is now sufficient to rule out Bug 635869 in this bug. 

By the way...

Please note that no one usually knows about your setting, and no one can know your setting unless he can touch your PC, until you provide information about your setting.
Please note that response like "Developers always ask me at IRC, if they want to get answer from me" is merely a rejection of answer to question from non-developer.
Please note that, as we usually don't know "what you know" and "what you don't know", we can't ask you like next always, with no typo;
> Thanks for reporting Tb's problem. 
> Your Tb setting may be relevant to this bug's problem.
> Could you please check your account setting by next, if you have time.  
>  Go Tools/Account Settings, select relevant IMAP account, if you can, please.
>  Select Server Settings at there, please, if you can find "Server Settings".
>  If you can find string of "When I delete a message:" at the setting,
>  check your "Just mark it as deleted" choice, please, please, please.
>  Is radio button for it shown like white dot? or like black dot?
Are you requsting me to search you at IRC and ask you at IRC for above?
FYI.
Simple and basic principle :
   Not (all conditions are true) == at least one of conditions is false
So, any of next can be an evidence that your problem is absolutely irrelevant to that bug.
(a) "Just mark it as deleted" is not used in your environment.
(b) "Consolidated Folders" view is not used and "All Folders" view is used
    at folder pane in your environment. 
(c) Tb doesn't store \Deleted flag or fails to store \Deleted flag
    in problem of comment #0 of this bug in your environment.

Above (c) can be checked with IMAP delete model of "Just mark it as deleted" and with "All Folders" view at folder pane, because, if "Just mark it as deleted" is used, "mail of \Deleted flag" is shown with strike-through line at thread pane of an IMAP folder as written in Bug 635869, and because Bug 635869 doesn't occur with "All Folders" view at folder pane.

"All Folders view" in checking of (c) can be replaced by next, if "Consolidated Folders" view is used in your environment. 
  At next, click account-n.
  It's similar to "Drafts folder of account-n" at "All Folders" view.
  Folder pane 
    Consolidated Folders (by arrow button at here, you can change folder view)
    + Inbox"                     "a Consolidated Folder" I called in that bug.
    - Drafts        <= expanded. "a Consolidated Folder" I called in that bug. 
      - account-a
      - account-b
                |
      - account-n  <= Relevant IMAP account name
                |
      - account-z
      - Local Folders
    + Sent                       "a Consolidated Folder" I called in that bug.
(Reporter)

Comment 31

7 years ago
(In reply to comment #29)
> So, "Just mark it as deleted is not used in your environment" is now sufficient
> to rule out Bug 635869 in this bug. 

I can confirm that in my account settings, under "When I delete a message", I have "Move it to this folder: [Trash]" selected.
(In reply to comment #31)
> I have "Move it to this folder: [Trash]" selected.

Thanks for providing information about your setting.
We now know that your problem is never dup of that bug.

Can you check about \Deleted flag of remaining old draft mails by procedure I wrote in comment #30?
  With "When I delete a message: Just mark it as deleted",
  and with "All Folders" view at folder pane. (ordinal/standard folder view)
Are not-deleted draft mails shown with strike-through line at thread pane?
(if shown with strike-thru line at "All Folders" view, \Deleted flag is surely stored by Tb)

By the way, Ehsan, do you use localized version of Tb?
If yes, "Consolidated Folders", "All Folders" are perhaps localized. I use en-US build in test in order to write terms used by en-US build in bug at B.M.O, so, terms I wrote may be different from terms used by your Tb.
Please noe that we can't know about your build, because you don't provide information about your Tb's build in this bug at B.M.O. Following is information about my Tb build which is shown at Help/About Thunderbird of my Tb 3.1.7.
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
Oh, sorry for my wrong term. Ehsan, please replace all my "Consolidated" by "Unified" in your head, please. I was confused on successor of "Smart Folders".
Term used by Tb 3.1 or later was "Unified Folders".
(Reporter)

Comment 34

7 years ago
(In reply to comment #32)
> Can you check about \Deleted flag of remaining old draft mails by procedure I
> wrote in comment #30?

No, because it took me more than a minute to figure out which procedure you're talking about, and I think the amount of time I've spent on this bug outweighs the severity of the issue in the first place.

> By the way, Ehsan, do you use localized version of Tb?

No.

And I'm using the "unified" view.

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15pre) Gecko/20110218 Lanikai/3.1.9pre

Unfortunately I won't have more time to provide more information on this bug, unless a developer needs my help to debug this.  Thanks for your help.  This does not require any more QA action.
Keywords: qawanted
Whiteboard: [can provide more info if needed]

Comment 35

7 years ago
Has the possibility of connection to Bug 482836 and bug 460085 been examined?


Ehsan, your reply please to comment 1?
(Reporter)

Comment 36

7 years ago
(In reply to comment #35)
> Ehsan, your reply please to comment 1?

You mean the save interval?  I tried to see if I can get that somewhere in the UI but failed.  I would presume the interval is the default value, since I don't recall changing it.

Comment 37

7 years ago
the default is 5 minutes.
tools/preferences > composition > general
(Reporter)

Comment 38

7 years ago
(In reply to comment #37)
> the default is 5 minutes.
> tools/preferences > composition > general

For me, it's 1 minute...

Comment 39

7 years ago
(In reply to comment #38)
> (In reply to comment #37)
> > the default is 5 minutes.
> > tools/preferences > composition > general
> 
> For me, it's 1 minute...

perhaps some add-on tweaked it. Anyway, see Bug 485524 - Frequent freezing during composition with "Attaching..." on Status Bar (autosave, compacting, IMAP) at zero to low cpu - low value for preference Auto Save every N minutes.

Does the problem reduce if you change autosave to 5 or 10 minutes?  If it does reduce, then perhaps this issue is gmail specific.

Also, a low value might have an effect on what you mention in bug 544079 comment 17 (duped to bug 289208).
(Reporter)

Comment 40

7 years ago
I'm not sure what the interval makes any difference here.  The issue is that when Thunderbird saves the draft message, it creates a new message in the drafts folder, instead of updating the old one.  The frequency just changes the frequency under which this occurs.  Please read comment 0.

Comment 41

7 years ago
(In reply to comment #40)
> I'm not sure what the interval makes any difference here.  The issue is that
> when Thunderbird saves the draft message, it creates a new message in the
> drafts folder, instead of updating the old one.  The frequency just changes the
> frequency under which this occurs.  Please read comment 0.

I well understand comment 0, and all these related bugs. I've done a lot of work in this area.

change the value and you probably see a change in behavior. I'm not saying it's a fix - but it is a strong contributor to causing the bad behavior in the situations I have seen and helped with.  And if you change the value, and the problem goes away, it would help us prove that your issue is probably related to the other bug reports.

Comment 42

7 years ago
(In reply to comment #40)
> I'm not sure what the interval makes any difference here.  The issue is that
> when Thunderbird saves the draft message, it creates a new message in the
> drafts folder, instead of updating the old one. 
Ehsan, there is no way in IMAP to edit a message. You have to create a new message, and delete the old message. The failure is in deleting the old message, almost certainly because we can't find it, for some reason.
setting dependencies so we can check bot bugs when one of them gets fixed.
Depends on: 482836
(Reporter)

Comment 44

7 years ago
(In reply to comment #41)
> (In reply to comment #40)
> > I'm not sure what the interval makes any difference here.  The issue is that
> > when Thunderbird saves the draft message, it creates a new message in the
> > drafts folder, instead of updating the old one.  The frequency just changes the
> > frequency under which this occurs.  Please read comment 0.
> 
> I well understand comment 0, and all these related bugs. I've done a lot of
> work in this area.
> 
> change the value and you probably see a change in behavior. I'm not saying it's
> a fix - but it is a strong contributor to causing the bad behavior in the
> situations I have seen and helped with.  And if you change the value, and the
> problem goes away, it would help us prove that your issue is probably related
> to the other bug reports.

OK, I changed it to 2, to see if it makes any difference.
(Reporter)

Comment 45

7 years ago
(In reply to comment #42)
> (In reply to comment #40)
> > I'm not sure what the interval makes any difference here.  The issue is that
> > when Thunderbird saves the draft message, it creates a new message in the
> > drafts folder, instead of updating the old one. 
> Ehsan, there is no way in IMAP to edit a message. You have to create a new
> message, and delete the old message. The failure is in deleting the old
> message, almost certainly because we can't find it, for some reason.

Hmm, that's a very plausible theory.  :-)
Atul:

Hey - just a stab in the dark, but do you think your GMail integration work will affect this bug?

-Mike
Mike, Autl,

I don't think Atul's project will help with this. The cause of the issue is server-side. There are two workarounds that I know of. 

1. In Gmail web interface, in the IMAP Access settings, select "Auto-Expunge off" and "Immediately delete the message forever". Unfortunatly, doing this can lead to accidentally permanatly deleting emails from other folders.

2. Use the addon that I wrote: https://addons.mozilla.org/en-us/thunderbird/addon/auto-save-drafts-folders/
Mike, I am not sure that my project will directly help this bug. But we can look into some workarounds.
Clearly we cannot follow the workaround-1 suggested by dlech. We cannot take the risk of deleting messages from some other folder. 
I guess we can go with what dlech has implemented in his addon. Making Drafts a local folder, and in background auto-sync the local-drafts folder with the email server.

Basic problem is we cannot edit a mail through IMAP, the only thing we can do is creating new message and deleting an old message. In case of Auto-draft save, we cannot find which message to delete.
(Reporter)

Comment 49

6 years ago
Has anybody looked into how other mail clients handle this?  I have not seen this bug with any other email clients.
(In reply to Ehsan Akhgari [:ehsan] from comment #49)
> Has anybody looked into how other mail clients handle this?  I have not seen
> this bug with any other email clients.

The ones I am familiar with...

Outlook:
Drafts and auto saved drafts are saved to local Drafts folder only. There is not an option to save to IMAP (online) folders.

Evolution:
Drafts are save to use specified mail folder - could be local or IMAP (online) folder. Auto saved drafts are saved to hidden folder in users home directory, not in any mail folders.

K-9 Mail (android):
Drafts are saved to IMAP (online) folders. Gmail has same problem of creating lots of copies in K-9 as with as Thumderbird.
So I guess Evolution seems to have solved the problem a bit, we can follow the same approach as evolution, or (as I mentioned earlier) dlech's addons' approach.
To me the intuitive solution is saving drafts to a local folder, and then auto-sync in background.
(Reporter)

Comment 52

6 years ago
(In reply to comment #51)
> To me the intuitive solution is saving drafts to a local folder, and then
> auto-sync in background.

That would make sense!
(In reply to Atul Jangra [:atuljangra] from comment #51)
> To me the intuitive solution is saving drafts to a local folder, and then
> auto-sync in background.

Do you mean the Local Folders mail folder in Thunderbird or just a file on the hard drive?
(In reply to David Lechner (:dlech) from comment #53)
> Do you mean the Local Folders mail folder in Thunderbird or just a file on
> the hard drive?

I would want to make a Local Folder "Drafts" in Thunderbird itself and then auto-sync with the server in background.
No longer depends on: 482836
(In reply to David Lechner (:dlech) from comment #47)

After some more bug hunting, I have realized that the issues I have been discussing here are actually the issues described in Bug 562748 and not the issue described in the original post of this bug. 

I can reproduce bug 562748 - getting multiple copies of drafts in Trash folder, but I cannot reproduce this bug - getting multiple copies of drafts in Drafts folder.

However, the workarounds I mentioned should still apply to this bug.
Dlech, so we need to create a Local "Drafts" folder in Thunderbird and auto-sync in background?

Ehsan, would you want the local drafts folder to be auto-synced with you Gmail server? I guess then local drafts will end up being in your Drafts folder.
(Reporter)

Comment 57

6 years ago
(In reply to comment #56)
> Ehsan, would you want the local drafts folder to be auto-synced with you Gmail
> server? I guess then local drafts will end up being in your Drafts folder.

What I would like to see is for the draft messages to not get duplicated in Gmail's drafts.  If that can only be done at the cost of those local draft messages not show up on Gmail, then so be it!  :-)

Comment 58

5 years ago
I can confirm this problem. It is also more or less identical to #402132.

Comment 59

5 years ago
Found this thread when searching on a very similar issue.

Using TB 17 on Win8 x64 machine.
gmail linked in via IMAP.

Whenever I am composing a draft in TB, the auto-saves maintain a single indicator within the DRAFTS folder.  TB continues to show a single draft.  When I finally send the message, TB shows no pending drafts.

However, when I log into the Web GUI of gmail, the DRAFTS folder contains multiple entries, with what appears to be each auto-save generating its own message.  The messages appear to be one per auto-save.  The auto-save interval is whatever gmail and TB's default is, I have not modified it.  The messages within the DRAFTS folder are not marked as deleted and I must manually clear them.

gmail IMAP setup:
ENABLE IMAP = TRUE
AUTO EXPUNGE = FALSE/OFF
WHEN MARKED AS DELETED = IMMEDIATELY DELETE
FOLDER SIZE = NO LIMIT

Any ideas?
brad m,
I guess you are facing the same problem as Ehsan. Auto-saving results in multiple entries of message in Drafts folder.

Comment 61

5 years ago
This problem is not limited to IMAP. I experience exactly the same problem with all my POP3 accounts as well.

This problem never happened in earlier versions of Thunderbird (not in 4 for sure).
Dlech,
Would you like to work on this bug? Strategy is pretty clear, I guess.
(In reply to Atul Jangra [:atuljangra] from comment #62)
> Dlech,
> Would you like to work on this bug? Strategy is pretty clear, I guess.

We'll see... if I can find some time. Seems to be a shortage lately.
Okay. Same is the case with me. I am all consumed in my university courses. Pretty much involved with developing an Operating System lately.
Lets hope to clear up this bug as soon as possible. :)

Updated

4 years ago
Blocks: 812827

Comment 65

3 years ago
I cannot reproduce the problem. Here is what I did.

With TB 41 (Earlybird) I added a Gmail account. Standard settings:

I composed a message, saving three drafts and the final draft that I then sent.

Result:
In TB:
No draft is left in the Gmail/Drafts folder.
Four drafts are stored in the Gmail/Trash folder.

In the Gmail web interface:
Drafts: No drafts.
Trash: Four drafts.

Then I repeated the same thing with "auto-save".
Composed a message, waited for auto-save.
Added some more text, waited for auto-save. Sent.

Result in TB and the Gmail web interface:
No drafts, two drafts in the Trash.

So far I couldn't reproduce the problem. However, upon reading comment #47 above, I went to check the IMAP settings in the Gmail account settings in the Gmail web UI. The default "Auto-Expunge on - Immediately update the server. (default)" was selected.

I selected what was suggested in comment #47 "Auto-Expunge off - Wait for the client to update the server." and repeated the first test case. Lo and behold, there are now four drafts in the Drafts folder, which are not visible from TB.

As far as I can see all works with the Gmail default option "Auto-Expunge on".

Ehsan, can you re-check this?
Flags: needinfo?(ehsan)
(Reporter)

Comment 66

3 years ago
Yes, I also have auto-expunge set to off, and the bug happens for me every day.
Flags: needinfo?(ehsan)

Comment 67

3 years ago
(In reply to :Ehsan Akhgari (not reviewing patches, not reading bugmail, needinfo? me!) from comment #66)
> Yes, I also have auto-expunge set to off, and the bug happens for me every
> day.

Are we misunderstanding each other here? I said:
As far as I can see all works with the Gmail default option "Auto-Expunge on". *On*, not off.
(Reporter)

Comment 68

3 years ago
(In reply to Jorg K from comment #67)
> (In reply to :Ehsan Akhgari (not reviewing patches, not reading bugmail,
> needinfo? me!) from comment #66)
> > Yes, I also have auto-expunge set to off, and the bug happens for me every
> > day.
> 
> Are we misunderstanding each other here? I said:
> As far as I can see all works with the Gmail default option "Auto-Expunge
> on". *On*, not off.

Sure.  And I'm saying that I have that setting set to off, and I can reproduce the bug.

Comment 69

3 years ago
(In reply to :Ehsan Akhgari (not reviewing patches, not reading bugmail, needinfo? me!) from comment #68)

> Sure.  And I'm saying that I have that setting set to off, and I can
> reproduce the bug.

So why don't you set it to *on* so you don't experience the bug?
(Reporter)

Comment 70

3 years ago
Because I don't want the auto-expunge behavior.

Comment 71

3 years ago
OK, so you want to run with "auto-expunge" set to off.

If you set "Clean up ("Expunge") Inbox on Exit" in the TB account settings ("Server Settings"), then the multiple drafts will be moved to the trash upon exit.

Even with "Clean up on exit" not set, it (mostly) works.

Test 1:
- Start TB, "auto-expunge" off, "Clean up on exit" also off.
- Edit E-Mail. Save multiple drafts. Do not sent message.
- Exit TB.
- Visit Drafts in the Gmail web UI. Only last draft is in Drafts.
  Superseded drafts are in Trash.
So that's working OK, is it not?

Test 2:
- Start TB, "auto-expunge" off, "Clean up on exit" also off.
- Edit E-Mail. Save multiple drafts. Sent message.
- Exit TB.
- Visit Drafts in the Gmail web UI. Your multiple drafts are there.
- Hit "refresh". Drafts disappear to the trash.
So that's working OK, is it not?

I can see that the behaviour is a little quirky if both "auto-expunge" in the Gmail web UI and "Clean up on exit" in TB are switched off. At times, you need to hit "refresh" in the Gmail web UI.

As I see it, it can be made to work, either with "auto-expunge" on or at least "clean up upon exit". I you don't want to use either option, then all we could do is investigate why at times you need to hit refresh before it becomes good in the Gmail web UI.
(Reporter)

Comment 72

3 years ago
So I sometimes see one draft message saved, and sometimes more than one, and as far as I can tell I don't do anything other than what you have said above.  And when I do get more than one draft message, no amount of reloading the web UI fixes it (the drafts stay there for weeks until I spend some time to clean them up.

The reason why I don't expunge on exit is that I don't want to delete my emails at all (and I don't usually hit delete in Thunderbird, but I turn these settings off as a protection against when I do that by accident.)  IIRC previously when I had auto expunge (or expunge on exit) turned on, I occasionally lost email because Thunderbird would delete the email instead of removing the label and moving the message into the "All mail" folder.

Comment 73

3 years ago
Strange. When you say "reloading the web UI" you mean "reload the page" in FF or "Refresh", the (almost closed) circle with the arrow between the "Select" and the "More" button?

I hit this "Refresh" button and messages (deleted drafts) disappeared and were moved to the trash.

I will create some deleted drafts now as per test case 2 and check whether they are there tomorrow.

Comment 74

3 years ago
BTW, I'm using Earlybird TB 41 on Windows 7 for the tests.

Actually, I didn't get to tomorrow. I saw three drafts after I exited TB (test 2), then clicked on Inbox and the drafts disappeared from Drafts.

Comment 75

3 years ago
I tried it again. The next morning, the three drafts I had left behind were in the Trash.

Updated

2 months ago
Duplicate of this bug: 1458823

Comment 77

21 days ago
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20100101

Steps to reproduce:

Hello! I'm running Thunderbird 52.7.0 on Debian Stretch.

Steps to reproduce the issue:
1. In Edit > Preferences > Composition check "Auto Save every x minutes"
2. Click "Reply" on any email to open the message composition window
3. Type something then wait for x minutes to auto save the email
4. Repeat step 3 couple of times
5. Finally send the email
6. Now click "All Mail" Gmail folder

Relevant Thunderbird configuration:
1. Server Settings > When I delete a message > Move it to this folder > Trash on foobar@gmail.com
2. Copies and Folders > Drafts and Templates > Keep draft messages in > Other > Drafts on foobar@gmail.com


Actual results:

I could see all my saved emails in the replying thread along with the final sent email.

I'm not sure if this matters but one visible difference to note is that while viewing the auto-saved draft email, a small green triangle is displayed after the "From" label and before the Sender Name. There is no green triangle while viewing the final sent email. Screenshot here: https://imgur.com/a/JwKoRjI


Expected results:

There should have been no saved emails but just the final sent email only.
You need to log in before you can comment on or make changes to this bug.