Grow with us: Join Postmark's new referral partner program and start earning
x

How to thread messages or prevent threading

What is message threading?

It is getting the email client to view messages as threads by including the message reply history with every newly sent message.

The most common use cases for threading are support boxes where you want to keep the message history included in each reply for your recipient’s reference, or messages you send where you expect a reply and a conversation.

How do you thread messages?

The emailing threading depends on the email client used, so it can’t really be guaranteed 100% of the time for all email clients, however, we’ve seen many email clients follow what Gmail does, they require that an incoming message’s Reference header, if present, must reference IDs of previous messages in order to thread. This means that if you receive two emails with the same subject from the same sender, these emails will not be threaded together unless one explicitly references the other. 

So we can say the requirements are:

  • A reference header with the same IDs as a previous message
  • The same recipients, senders, or subject as a previous message
  • Sent within one week of a previous message

How would that work with Postmark Inbound Processing?

It could be a bit of a challenge to ensure that a reference ID you include in the first outbound message, gets sent back when your recipient replies to your first outbound message.

If you use Postmark for both outbound and inbound, and you’re wondering what kind of reference ID you should include, that has a high possibility of being kept in your recipient’s reply, that would be the Reply-to field. This is done by using the + sign to split the reply-to address and following it with any important information that needs to be captured.

Here is what the headers might look like in your comment notification:
From: reply@yourapp.com
Reply-to: reply+userIDthreadID@yourapp.com
To: youruser@domain.com

When someone replies to this email, Postmark will be able to parse the information after the + sign into the MailboxHash field of the JSON document, allowing you to easily associate the reply with the correct user and thread in your application.

Note: This is not guaranteed to work in every single case as every email client would handle replies differently, as we’ve seen, but this remains one of the more reliable references you can use.

How do you make sure messages aren’t threaded?

  • Send each message with a unique reference header value that doesn’t match a previous message.  
  • Create a new subject for each message that you don’t want to group.

An Example:

Message one has this header field:

	"Headers": [
	{
	"Name": "References",
	"Value": "<12345>"
	}

Message two has this header field:

	"Headers": [
	{
	"Name": "References",
	"Value": "<54321>"
	}
	]
Last updated October 24th, 2024

Still need some help?

Our customer success team has your back!