Open Bug 1525885 Opened 6 years ago Updated 2 years ago

Message-Id not preserved when sending draft email

Categories

(MailNews Core :: Composition, defect)

defect

Tracking

(Not tracked)

People

(Reporter: nicolas, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

Using TB 60.3.0 on Linux:

  • Create mail and save to Draft (IMAP account)
  • Check Message-Id in mail source in Draft folder
  • Double click email in Draft folder (or click edit)
  • Send Later
  • Check message-id in outbox
  • Send unsent messages

Actual results:

Original message-Id in Draft folder:
Message-ID: <15f54c23-7796-30ab-530f-ba4b29a3004b@morey-chaisemartin.com>

Message ID in Outbox:
Message-ID: <0c60ebf8-c181-d231-57a1-ed8ac5ab3e96@morey-chaisemartin.com>

Received Message-Id:
Message-ID: <0c60ebf8-c181-d231-57a1-ed8ac5ab3e96@morey-chaisemartin.com>

Expected results:

Message-Id should not be changed when sending a draft email.

Tools like git rely on this to sent patch series as threaded (git imap-send can be used to create drafts on the IMAP server)

Note that behavior is the same whether drafts were created manually or uploaded to the Draft folder by git

Sorta like bug 1421736 ?

Component: Untriaged → Composition
Flags: needinfo?(jorgk)
Product: Thunderbird → MailNews Core
Summary: Mesage-Id not preserved when sending draft email → Message-Id not preserved when sending draft email

I don't understand the question. Bug 1421736 was about templates and we fixed it as part of bug 1389062.

I've just tried this:
ID in drafts:
Message-ID: <fdabf746-e5c9-4ee4-6530-7c95d9af55be@jorgk.com>

Edited and saved again, ID unchanged.

ID in outbox:
Message-ID: <7c3d22f4-3edd-27ec-4389-365162ff5662@jorgk.com>

I've read through bug 1279869 again, that was long ago, and it was about a different issue.

Reporter: Why is it bad to allocate a new ID upon send? Please explain the "Message-Id should not be changed when sending a draft email".

Magnus, do you have an opinion here?

Flags: needinfo?(jorgk) → needinfo?(mkmelin+mozilla)

My use case is with git. When exporting a patch series, it is expected for all patches to be threaded (usually all are replies to the first one or to a cover letter)

To handle this, git uses the Message-Id from the first patch (or the cover letter) and adds a flag to mark the following patches as reply of this one (I'm on my phone so can't check the exact field name now)

Changing the Message-Id when sending means that the following patches will be marked as replies to a non existing Message-Id and not be threaded at reception.

Hmm, generally threading uses the References: header. You get a message with ID1, you reply with ID2 and have ID1 in the References: header.

I think the key to understanding the use case is what you wrote in bug 1279869 comment #26 (quote):

  • Generates patches from git into DRAFT (git format-patch | git imap-send)
  • Editing the patch within the draft folder and saving it keeps the Message-ID
  • When sending the patch, Message-ID has changed.

So somehow git produces some drafts(?) and instead of replying which would copy the message ID to the References: header, you edit the draft and hope that the ID is preserved upon sending. Hmm.

I think it uses the In-Reply-To header (that's the CLI option name at least)
But yes the issue is that all the drafts are generated at once.
So the Message-Id of the sent first message is not yet available and so the Message-Id it currently has in the Draft folder is used.

I currently work around the issue by sending the first mail. Manually get his Message-Id and regenerating the other draft for ing the In-Reply-To value in the CLI.
It works but is highly unpractical.

is there a rationale behind changing the Message-Id between Draft and Sent email?

I agree the Message-Id should be kept. (There could be good reasons to make sure it stays otherwise too so you could refer to a mail you're sending by id.)
We must make sure the id is never reused though, and guaranteeing that might be tricky, e.g. in case someone goes back to a draft and creates another mail from it.

Flags: needinfo?(mkmelin+mozilla)

Well, "edit as new" on a draft uses a new ID. It is possible that a superseded draft isn't deleted in which case you could edit it again and send a message with the same ID.

(In reply to Magnus Melin [:mkmelin] from comment #6)

I agree the Message-Id should be kept. (There could be good reasons to make sure it stays otherwise too so you could refer to a mail you're sending by id.)
We must make sure the id is never reused though, and guaranteeing that might be tricky, e.g. in case someone goes back to a draft and creates another mail from it.

(In reply to Jorg K (GMT+1) (PTO to 15th Dec 2019, sporadically reading bugmail) from comment #7)

Well, "edit as new" on a draft uses a new ID. It is possible that a superseded draft isn't deleted in which case you could edit it again and send a message with the same ID.

So this bug should be marked NEW?

Flags: needinfo?(mkmelin+mozilla)

I suppose so.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mkmelin+mozilla)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.