# Mac Mail Threading

**URL:** https://meta.discourse.org/t/mac-mail-threading/56194
**Category:** Support
**Created:** [January 23, 2017, 7:57am UTC](https://meta.discourse.org/t/mac-mail-threading/56194 "2017-01-23T07:57:08Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [January 23, 2017, 7:57am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/1 "2017-01-23T07:57:08Z")

</div>

Yes, sigh, I know, again.

1.7 breaks the workaround we had for Mac Mail threading, namely always including “Re:” at the start of the subject

Setting for email subject `Re: [%{site_name}] %{optional_pm}%{topic_title}`

Unfortunately, Discourse 1.7 sensibly does not include an “In-Reply-To” on the first post, and this results in the first post being threaded separately from the replies in Mac Mail.

I have a hack to put the “In-Reply-To” back:

```diff
         @message.header['Message-ID'] = incoming_message_id || post_message_id
- if post && post.post_number > 1
+ if post
           @message.header['In-Reply-To'] = referenced_post_message_ids.first || topic_message_id
+ end
+ if post && post.post_number > 1
           @message.header['References'] = [topic_message_id, referenced_post_message_ids].flatten.compact.uniq
         end

```

but this is obviously less than ideal. That said, I’ve got no ideas for any better solution, and the alternative (the initial post being threaded separately from replies) is very bad for those of us using Mailing List Mode since it appears as an unanswered question even though there are answers.

I’m hopeful someone else will have some better idea to restore Mac Mail threading, or a better workaround, or something…? Failing that, at least this documents the issue for anyone else with lots of Mac forum users.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2017, 8:12am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/2 "2017-01-23T08:12:31Z")

</div>

> [@peternlewis](#):
>
> Setting for email subject `Re: [%{site_name}] %{optional_pm}%{topic_title}`

Wait, so this setting no longer works? I’m not totally clear what is being reported here.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 23, 2017, 10:00am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/3 "2017-01-23T10:00:58Z")

</div>

> [@peternlewis](#):
>
> Unfortunately, Discourse 1.7 sensibly does not include an “In-Reply-To” on the first post, and this results in the first post being threaded separately from the replies in Mac Mail.

It doesn’t make sense to have the first post be a reply of… nothing…

Are you sure Mac Mail only uses the title to do the threading? That would be a huge oversight on their part to not use the `References` and `In-Repy-To` headers…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 23, 2017, 10:02am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/4 "2017-01-23T10:02:14Z")

</div>

I believe in previous dicussions it was established that _yes_, it uses the dumb `Re:` text presence in the title above all else.

It is deeply and profoundly dumb, but it is the status quo for Mac mail, unfortunately.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 23, 2017, 10:09am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/5 "2017-01-23T10:09:22Z")

</div>

I’ll make some tests (and fix if needed) to ensure the title doesn’t change.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [January 23, 2017, 11:18am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/6 "2017-01-23T11:18:11Z")

</div>

I thought that the point of this topic was making the Re: always there _wasn’t_ working anymore?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 23, 2017, 11:19am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/7 "2017-01-23T11:19:11Z")

</div>

Yup, that’s what I’ll test and fix if needed.

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [January 23, 2017, 12:21pm UTC](https://meta.discourse.org/t/mac-mail-threading/56194/8 "2017-01-23T12:21:32Z")

</div>

OK, let me try to be more clear on what I was and am seeing.

The only way I have found to get Mac Mail to thread Discourse properly is:

1. Subject always starts with “Re:” (even the first message).
2. Mail messages have an “In-Reply-To” header (even the first message).

Discourse 1.7 “fixes” the second case, sensibly omitting the “In-Reply-To” on the first message, which has the side effect of breaking the threading for that first message, resulting in the first message showing up by itself, and the remainder showing up in a separate thread (perhaps separated by other topics).

When I encountered the issue previously, I tried tests with Mac Mail and the various reply/references headers and never found a good alternative solution, even with perfectly formatted headers, except for “Re:” on all messages. But perhaps someone can come up with something that works properly on Mac Mail and that makes sense for Discourse to adopt.

---

<div class="post-metadata">

### Author: ![rriemann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rriemann/32/115238_2.png) [@rriemann](https://meta.discourse.org/u/rriemann)
#### Post date: [January 23, 2017, 1:01pm UTC](https://meta.discourse.org/t/mac-mail-threading/56194/9 "2017-01-23T13:01:52Z")

</div>

I am not a Mac user and opposed to the idea to break Discourse in order to help those that use a broken Mail app. “Re” has a meaning and if you just use it always, it does not have any meaning anymore. I suggest to push Apple to fix their software or use other software.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 23, 2017, 4:37pm UTC](https://meta.discourse.org/t/mac-mail-threading/56194/10 "2017-01-23T16:37:30Z")

</div>

> [@rriemann](#):
>
> I am not a Mac user and opposed to the idea to break Discourse in order to help those that use a broken Mail app.

No worries. I’m not planning on breaking anything 😉 Just making sure overriding the email subject works.

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [January 24, 2017, 3:31am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/11 "2017-01-24T03:31:45Z")

</div>

I did not suggest breaking Discourse. Discourse already supports configurable subjects, and thus has no problem with the hack to always include the “Re:” instead of optionally including the “Re”.

I’m very glad that not everyone has to care about having a large number of Mac Mail readers, and it must be nice to be so optimistic as to think that reporting an issue to Apple (which has been done years ago) would result in a fix.

But sadly, I, and my many Mac Mail using Discourse forum users, have to deal with the fact that Mail is broken in this regard and Apple is not likely to fix it, and so it would be nice if there was some solution for my forum and other similarly Mac-heavy forums.

That said, Discourse’s handling of the In-Reply-To and Message-ID headers is not correct either - if it was I might have a stronger case to take to Apple (who would still do nothing to fix the issue). The change in version 1.7 does take Discourse a step closer to having valid headers in this regard, sadly it just results in worse behaviour with Mac Mail.

In Discourse 1.7, the initial message has a Message ID of something like:

```plaintext
Message-ID: <topic/6118/28585@forum.keyboardmaestro.com>

```

and the reply to the topic or the first post results in:

```plaintext
In-Reply-To: <topic/6118@forum.keyboardmaestro.com>
References: <topic/6118@forum.keyboardmaestro.com>

```

Which is referencing a message ID that never exists.

I don’t actually believe that even if this was done Mail would get the threading right, but presumably there is some set of header behaviours that would work.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 24, 2017, 3:39am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/12 "2017-01-24T03:39:43Z")

</div>

Hmm he has a point @zogstrip the first post should have just the topic id as the identifier.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 1, 2017, 10:05pm UTC](https://meta.discourse.org/t/mac-mail-threading/56194/13 "2017-02-01T22:05:32Z")

</div>

The logic was flawed… Hopefully I got it right this time 😊

[https://github.com/discourse/discourse/commit/82555ca7612e497df31f9f4fc6969049a9887988](https://github.com/discourse/discourse/commit/82555ca7612e497df31f9f4fc6969049a9887988)

@peternlewis, can you let me know if it works for you?

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [February 2, 2017, 4:35am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/14 "2017-02-02T04:35:27Z")

</div>

Looks great, seems to fix the Mail threading issue.

I changed my subject like to %{optional\_re} at the front and it continues to thread correctly which is wonderful.

Thanks!

Will this patch be in 1.7.3?

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [March 16, 2017, 2:12am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/15 "2017-03-16T02:12:25Z")

</div>

When is this patch going in to Discourse? It was not in 1.7.3 - is it in 1.7.4?

Thanks.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [March 16, 2017, 8:04am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/16 "2017-03-16T08:04:17Z")

</div>

We only backport security fixes. The patch is already available in the 1.8.0 beta.

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [March 16, 2017, 8:31am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/17 "2017-03-16T08:31:05Z")

</div>

Is there anywhere that explains the version numbering and what’s in what version? I had no idea 1.7 development was finished at 1.7.2. Anyway, so not until 1.8 final.

Thanks.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 16, 2017, 10:13am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/18 "2017-03-16T10:13:29Z")

</div>

The only 1.7.x releases will contain **critical security fixes**. As this is not a security fix, it won’t be included.

This is true of every `x.y.z` release since we started, if the `.z` number changes, it is exclusively and only due to a security fix for version `x.y`.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 22, 2017, 11:13am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/19 "2017-08-22T11:13:42Z")

</div>

This is good now yes?

---

<div class="post-metadata">

### Author: ![peternlewis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/peternlewis/32/108888_2.png) [@peternlewis](https://meta.discourse.org/u/peternlewis)
#### Post date: [August 23, 2017, 2:35am UTC](https://meta.discourse.org/t/mac-mail-threading/56194/20 "2017-08-23T02:35:07Z")

</div>

Yes, it appears all good, with no need to patch Discourse any further on my part.

Thanks.

[Next page](https://meta.discourse.org/t/mac-mail-threading/56194.md?page=2)
