Drafts appear as a new message in New Mail Alert by Biff when a new email arrives at Inbox. "New mail" state of saved draft mail is incorrect, even if draft is saved as Unread.

NEW
Unassigned

Status

MailNews Core
Backend
6 years ago
13 days ago

People

(Reporter: Wesley Hardman, Unassigned)

Tracking

(Blocks: 3 bugs)

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
If you are composing a draft message and the email has been saved to the drafts folder, the draft message will be displayed as a new message when Thunderbird receives an new message from the server.

Tested on the latest Daily (2012-11-06).

STR:
1. Create a new draft.
2. Save the draft.
3. Wait for Thunderbird to download a new message from the server.
4. Notice what the notification displays.

Expected Result:
A notification appears showing the new message that was received.

Actual Result:
A notification appears showing the new message and the draft that was saved.


Other email clients do not show a notification for the draft email.

Updated

6 years ago
Blocks: 812827

Comment 1

6 years ago
let's assume this is same as bug 767051
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 767051
(Reporter)

Comment 2

6 years ago
Re-opening this as I don't feel it is a duplicate of the bug 767051.

As I stated in bug 767051 comment 11
I specifically only see this when I receive a new message (other than the draft), and EVERY time I see a new message, until there is no longer a new draft message.  The other bug appears to be for receiving a notification for the draft message, when the ONLY email is the draft message.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---

Updated

5 years ago
Depends on: 767051
(A) Is Draft included in periodical new mail check? (Folder Properties/General of Drafts)
(B) Is IDLE command use enabled? (Server Settings, Advanced)
(C) Is max cached connection > 1? (Server Settings, Advanced)

If A=No and B=Yes/C=Yes, phenomenon may be following.
(i) When new draft mail in Draft(no \Seen by bug 673400) is notified via IDLE, it's excluded from new mail alert by A=No.
(ii) However, because "new mail alert"(Biff) is Tb wide feature and is not per folder feature, "new draft mail in Draft(no \Seen by bug 673400) notified via IDLE" is included in new mail alert by Biff which was invoked for other than Drafts.

If so, I think workaround of "Disable IDLE", which is already indicated in some already pointed bugs, is effective.
Have you tried it? 

Note: 
Bug 767051 is perhaps;
Because namespace="INBOX." is used and server forces "All folders under inbox", Drafts is sub folder of Inbox. Check of "SpecialUSE flag of Inbox == On" of Drafts folder is done with "inherit from parent folder, search flag of parent" mode, in order to support "namespace="INBOX." case without additional setting by uer. And, "Inbox" is always folder of "SpecialUSE flag of Inbox == On". So, when automatic new mail check on Inbox is enabled, new mail check(Biff) is invoked on INBOX.Drafts or INBOX/Drafts too. Thus, due to "no \Seen flag by bug 673400, draft mail is always shown in new mail alert.
(In reply to Wesley Hardman from comment #2)
> I specifically only see this when I receive a new message (other than the draft), 
> and EVERY time I see a new message, until there is no longer a new
> draft message.

Thanks for re-opening this bug for clear and pure case.

I could see it, with IDLE is disabled, no new mail check except Inbox, and with auto-sync disabled.
(0) IDLE is disabled, no new mail check except Inbox,
    with auto-sync disabled.
(1) Select IMAP account, go Work Offline, go back to Work Online
    => Nothing is selected at any cached connection.
(2) Save As Draft
    => Drafts is selected at a cached connection.
       At first cached connection : select Drafts, append with no \Seen
       "uid store -Flags(\Deleted)" for old draft
    => "uid fetch yy Flags() body.peek[headers(Subject ...)"
       for new draft mail.
    New mail in Drafts is detected by message header fetch after Save.
(3) Send a mail to this account.
    => New mail is detected by Biff(new mail check) at Inbox
(4) New mail alert is shown by Biff.
    New mail in Drafts folder is shown by "New Mail Alert by Biff".

Confirming.

This is not Drafts only phenomenon.
If new mail is detected at an Mbox by "New mail check by Biff", "Periodical new mail check by auto-sync", or by "via IDLE", status of "Mbox has new mails" is correctly set for the Mbox by Tb.
If "task-tray icon for new mail" is closed by "click of Inbox" when new mail arrives at Inbox, "New mail Alert" is shown by Biff.
Because status of "Mbox has new mail" of Mbox is not cleared until all new mails is viewed or Mbox is re-opened(click other Mbox, then click Mbox again), and because Biff shows "new mail in any Mbox" upon new mail alert, phenomenon you see occurs.

A possible solution of this bug.
  Show new mails of an Mbox in new mail alert of Biff,
  only when "new mail check by Biff" is enabled for the Mbox.
However, "new mail detected via IDLE" is also a valid "New mail".

As for "auto-saved draft mail with no \Seen" case, using add-on like following is better.
- Different draft folder for auto-save
  See Bug 562748 Comment #24.
By the add-on, user can use any folder of "Local Folders" as "Drafts for auto-save". So, new mail alert shows "new draft mail in IMAP Drafts" only when you intensionally saved draft mail to IMAP Drafts in order to share draft mail with other IMAP client.
Main purpose of auto-save is protection from problem like "crash whle mail composition". Such add-on is sufficient for such purpose.
Status: UNCONFIRMED → NEW
Component: General → Backend
Ever confirmed: true
Product: Thunderbird → MailNews Core
Version: Trunk → 17
Blocks: 767051
No longer depends on: 767051
FYI.
"new mail" in this bug :
      mail of larger UID than HighestUID which Tb knows,
  and mail of no \Seen flag, no \Deleted flag.
Summary: Drafts appear as a new message when a new email arrives → Drafts appear as a new message in New Mail Alert by Biff when a new email arrives at Inbox
As for "newly saved draft mail by Tb himself", as seen in STR of comment #4, "New Mail" in Drafts is never detected by "new mail check by Biff/auto-sync" nor "via IDLE". "New Mail" is detected by "message header fetch for newly saved draft mail" which is invoked by Tb after draft save.
So, if "New Mail" state is not set for "newly saved draft mail", this bug on draft mail won't occur.

If UIDPLUS is supported, UID for newly appended draft mail is returned from server to IMAP "APPEND" command. So, if UIDPLUS is supported, "prohibiting Mew mail state of newly save draft" is possible and is not so hard. However, if UIDPLUS is not supported, "SEARCH for messageg-ID, Subject etc." is needed to know UID of the newly saved draft mail. It'll make program code complex.

IIRC, "Copy of Unread mail from other account" won't produce "New mail state" of the copied mail. What is difference between "draft save with no \Seen" and "copy Unread mail from other account"?
To bug opener:

When a "New Mail" in an Mbox is generated by server(newly arrived mail to Inbox) or by other IMAP client(append/upload/copy/move of Unread mail to an Mbox), the "New Mail" is detected by Thunderbird by "Folder open", "New mail check by Biff", "New mail check by auto-ssync", and "via IDLE".

When the "New Mail" should be shown in new mail alert?
When the "New Mail" shouldn't be shown in new mail alert?
  - mail in folder used as Draft folder
  - mail which has \Draft flag
  - mail placed in Mbox for which new mail check is not requested
  - other than above
Summary: Drafts appear as a new message in New Mail Alert by Biff when a new email arrives at Inbox → Drafts appear as a new message in New Mail Alert by Biff when a new email arrives at Inbox. "New mail" state of saved draft mail is incorrect, even if draft is saved as Unread.

Updated

5 years ago
Duplicate of this bug: 901929

Comment 9

4 years ago
I tried to fix this problem with this addon (waiting for a review at the moment): https://addons.mozilla.org/en-US/thunderbird/addon/imap-draft-unread/

It works for me, so now the drafts are unread but doesn't trigger a mail alert.
There is an option also to set the drafts as read.

Comment 10

3 years ago
This problem occurs with Seamonkey on Linux as well.

Updated

5 months ago
Duplicate of this bug: 1442816

Comment 12

5 months ago
Created attachment 8956688 [details] [diff] [review]
drafts-no-notifiy.diff

Here's what seems like a quick fix for this (WIP). Skips over folders that have the "Virtual" and now "Drafts" flag set. Not sure, but maybe all "SpecialUse" flagged folders except INBOX (i.e., junk, sent, trash and templates and other?) should not notify when new mail is present. Anyhow, with this change, there is now no notification for new/unseen items in Drafts when new mail arrives in INBOX.
Attachment #8956688 - Flags: feedback?(jorgk)

Comment 13

5 months ago
Created attachment 8956710 [details] [diff] [review]
drafts-specialuse-no-notifiy.diff

This is another way that skips most of the special-use mailboxes instead of skipping explicitly Drafts. Note that it does not skip Inbox (where new messages will most typically be) since Inbox is also a member of the special-use mailbox set.

So any new/unseen mail in the special use folders, except for Inbox, will not produce a pop-up notification.

These are the special-use mailboxes, from  comm-central/mailnews/base/public/nsMsgFolderFlags.idl:

/// Special-use folders
const nsMsgFolderFlagType SpecialUse = Inbox|Drafts|Trash|SentMail|
                                       Templates|Junk|Archive|Queue;

Note also that the actual folder names for most of these can be assigned other names than the generic names show, i.e., customized or localized, and this patch will still work.
Attachment #8956710 - Flags: feedback?(jorgk)

Comment 14

5 months ago
Comment on attachment 8956688 [details] [diff] [review]
drafts-no-notifiy.diff

Thanks for the research, the other patch is more comprehensive.
Attachment #8956688 - Flags: feedback?(jorgk)

Comment 15

5 months ago
Comment on attachment 8956710 [details] [diff] [review]
drafts-specialuse-no-notifiy.diff

Thanks again for looking at this. This seems reasonable. However, I'm no expert here, so let's get some other feedback.
Attachment #8956710 - Flags: feedback?(jorgk)
Attachment #8956710 - Flags: feedback?(acelists)
Attachment #8956710 - Flags: feedback+

Comment 16

2 months ago
Aceman, can we please move this bug forward.
Flags: needinfo?(acelists)

Updated

23 days ago
Attachment #8956710 - Flags: feedback?(acelists) → review?(acelists)

Comment 17

14 days ago
Comment on attachment 8956710 [details] [diff] [review]
drafts-specialuse-no-notifiy.diff

Review of attachment 8956710 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, this looks interesting.
Checking for Inbox first seems to also cover cases where the same folder is used for Inbox and Sent (part of SpecialUse) simultaneously.

What about other non-Inbox folders? If user created some more folders and uses one of them as Sent, can messages be delivered into those folders? And may the user expect to be notified about those? I am not familiar with IMAP here.

::: mailnews/base/content/newmailalert.js
@@ +57,5 @@
>    for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
>    {
> +    if (folder.hasNewMessages && (folder.getFlag(Ci.nsMsgFolderFlags.Inbox) ||
> +          !(folder.getFlag(Ci.nsMsgFolderFlags.Virtual) ||
> +             folder.getFlag(Ci.nsMsgFolderFlags.SpecialUse))))

As SpecialUse is already a composition of multiple flags, maybe this could be written as folder.getFlag(Ci.nsMsgFolderFlags.Inbox) || !folder.getFlag(Ci.nsMsgFolderFlags.SpecialUse | Ci.nsMsgFolderFlags.Virtual)
Attachment #8956710 - Flags: feedback?(vseerror)

Comment 18

13 days ago
Comment on attachment 8956710 [details] [diff] [review]
drafts-specialuse-no-notifiy.diff

(In reply to :aceman from comment #17)
> ...
> What about other non-Inbox folders? If user created some more folders and
> uses one of them as Sent, can messages be delivered into those folders? And
> may the user expect to be notified about those? I am not familiar with IMAP
> here.

I think yes. But that would be more of an edge case than Inbox being set as sent.  And I can offer that I have sent -> Inbox for almost all my accounts.

Clearing feedback, as I don't really have an opinion on the code itself
Flags: needinfo?(acelists)
Attachment #8956710 - Flags: feedback?(vseerror)

Comment 19

13 days ago
Note there a quite a few other biff bug reports, perhaps most notable is bug 479282.  https://mzl.la/2J3Zo6X is a partial list
You need to log in before you can comment on or make changes to this bug.