in-reply-to
is set to this value
In-Reply-To: <topic/16501@meta.discourse.org>
Thus, all replies should thread to this topic, if what you say is true. Is it?
in-reply-to
is set to this value
In-Reply-To: <topic/16501@meta.discourse.org>
Thus, all replies should thread to this topic, if what you say is true. Is it?
No. You may talk about these headers:
In-Reply-To: <topic/16501@meta.discourse.org>
References: <topic/16501@meta.discourse.org>
It has been explained here why it is wrong:
In-Reply-To
and References
must point to a unique message id. <topic/16501@meta.discourse.org>
is not a unique message id thus mail clients cannot do threading. It works when I replace these headers with its correct message ids manually on the imap server.
edit:
I had a look on a github email. They do it this way:
Message-ID: <discourse/onebox/pull/257/r20941543@github.com>
In-Reply-To: <discourse/onebox/pull/257@github.com>
References: <discourse/onebox/pull/257@github.com>
Maybe fixing the Message-ID
in discourse mails suffices. Dicourse does it this way (wrong!):
Message-ID: <5475a885c34fd_2fd5036a24480ae@archvm.mail>
In-Reply-To: <topic/753@discourse.sevenbyte.org>
References: <topic/753@discourse.sevenbyte.org>
Hmmm⌠How about this?
Message-ID: <topic/16501/27@meta.discourse.org>
In-Reply-To: <topic/16501/26@meta.discourse.org>
References: <topic/16501/25@meta.discourse.org> <topic/16501/26@meta.discourse.org>
What you describe is impossible â I donât know how to get, in Ruby code, the message ID header that the mail server appends to emails at the time it sends them, before dispatching the email. That ID doesnât even exist until the message is being transmitted.
Those ids are created at the time the message is sent by the mail server as far as I know, and they are internal to the mail server software.
Also, the âin reply toâ should always be in reply to the original topic creation, the first post of the topic, which you may never have even received an notification about. So there is no âmessage idâ to work with in that caseâŚ
As far as I know it is created by the first SMTP server when it is missing. Maybe this could help; it should be possible with action mailer.
That is not that bad. I just tried it on a mailman mailinglist in my inbox. I deleted the parent message and the threading did not break because the References
headers are fine. Maybe also this commit description here could help a bit: https://projects.archlinux.org/aur.git/commit/?id=8658bf22aac73ed8d32d3f998c3c13528f415ffe
see here:
Note: Some implementations parse the "References:" field to display
the "thread of the discussion". These implementations assume that
each new message is a reply to a single parent and hence that they
can walk backwards through the "References:" field to find the parent
of each message listed there.
As @codinghorror mentioned in-reply-to must be the first email. So it should be sth. like this, shouldât it?
Message-ID: <topic/16501/27@meta.discourse.org>
In-Reply-To: <topic/16501/1@meta.discourse.org>
References: <topic/16501/25@meta.discourse.org> <topic/16501/26@meta.discourse.org>
Which is fine, but letâs say this happens:
So there are three numbers in play here:
Note that this post is a reply to the topic. Thatâs the typical case, we want email to thread based on the TOPIC. We have no idea if you have an email about the first post, though.
So when you get an email notification about the mention (post #28), that email should contain:
Message-ID: <topic/16501/28@meta.discourse.org>
In-Reply-To: <topic/16501@meta.discourse.org>
References: <topic/16501@meta.discourse.org>
I guess âReferencesâ is the key here? All the posts in a topic should âreferenceâ the first post, even though you may not have that email message.
Right now it says
Message-ID: <54752ba335286_633fee205cc454883a2@tiefighter6-virtual_host.mail>
In-Reply-To: <topic/91@talk.thumbtack.io>
References: <topic/91@talk.thumbtack.io>
So the only thing missing is the Message-ID header. All replies are in reply to the first post of the topic, thoughâŚ
OK I just checked this in
topic_identifier = "<topic/#{topic_id}@#{host}>"
post_identifier = "<topic/#{topic_id}/#{post_id}@#{host}>"
@message.header['Message-ID'] = post_identifier
@message.header['In-Reply-To'] = topic_identifier
@message.header['References'] = topic_identifier
Letâs see if that helps? no idea, but I can check headersâŚ
Also hereâs what a random GitHub reply has in it
Message-ID: <discourse/discourse/pull/3006/c64666078@github.com>
In-Reply-To: <discourse/discourse/pull/3006@github.com>
References: <discourse/discourse/pull/3006@github.com>
so this might be the missing header we needed, if it works.
OK I can confirm this works. In a reply I just got via email here I see
Message-ID: <topic/22572/86235@meta.discourse.org>
In-Reply-To: <topic/22572@meta.discourse.org>
References: <topic/22572@meta.discourse.org>
So it corresponds pretty exactly with what GitHub sends in their email notifications. Thanks for the nudge @rumpelsepp hopefully this helps.
Youâre welcome.
It looks fine now but I donât know if there are any issues left. I will just test it a few days. In case of issues I will ping you back. Anyway, thanks for the fix!
Threads now well in KMail, K9 and Thunderbird! But only Roundcube has still problems with this. Maybe this is now a roundcube upstream issue rather than a discourse one, isnât it?