I’m making a webstore with integrated customer service. Every few minutes, the system will retrieve emails into the database, parsing headers and relating the message to customers and orders.
Customer threading is fairly reliable via the messages From: header. But what about orders? It seems most people use the Reply-To: header for threading orders …
From: <orders@company.com>
To: <person@place.com>
Subject: Company Order #314159
Reply-To: <order-314159@company.com>
But a messy Reply-to: obscures and uglifies things, and probably flags spam sensors or something. I definitely don’t want to count on the Subject: field, people modify the subject all the time, even when replying. There are other headers that seem suited to the job, like …
From: <orders@company.com>
To: <person@place.com>
Subject: Company Order #314159
Message-ID: <314159-2>
… or …
In-Reply-To: <314159-1>
But are these sent back when the person reply? Are there any headers (other than Reply-To:) that are reliably copied into replies and forwards?
You can’t rely entirely on headers being preserved. When replying or forwarding, a mail client creates a new message; that mail client can quite legitimately ignore or alter any content, as deemed appropriate.
You might be able to track by the following means, but all are vulnerable to alteration (mainly by the user, but also by a primitive mail client). You should really just use them to make a best-guess.
In-Reply-ToandReferenceheaders are probably fine, when supported. There is a small chance that a user will copy their reply into a new blank message and trash the headers anyway.