From c915a064a940daa8ff865d379ec309ff0199d57c Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 22 Jun 2011 15:37:30 -0700 Subject: [PATCH] Include both the Gmail and "natural" Message-IDs in the "References" header Summary: See T251, where gregprice correctly argues that we need both: None of the other people on the thread will have seen that message, so it seems like a lot of clients would put the server's message in a new thread. In general, I think you want the References: header to mention every ancestor message in the thread that you know about, because that's how MUAs keep a thread together in the face of missing some of its messages. Test Plan: Sent a reply email locally, got a response with both Message-IDs in "references". Reviewed By: rm Reviewers: gregprice, rm Commenters: gregprice CC: aran, gregprice, epriestley, rm Differential Revision: 499 --- .../metamta/storage/mail/PhabricatorMetaMTAMail.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php index 7ea4ecec31..2251d3ac63 100644 --- a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php @@ -298,12 +298,17 @@ class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { $mailer->addHeader('Message-ID', $value); } else { $in_reply_to = $value; + $references = array($value); $parent_id = $this->getParentMessageID(); if ($parent_id) { $in_reply_to = $parent_id; + // By RFC 2822, the most immediate parent should appear last + // in the "References" header, so this order is intentional. + $references[] = $parent_id; } + $references = implode(' ', $references); $mailer->addHeader('In-Reply-To', $in_reply_to); - $mailer->addHeader('References', $in_reply_to); + $mailer->addHeader('References', $references); } $thread_index = $this->generateThreadIndex($value, $is_first); $mailer->addHeader('Thread-Index', $thread_index);