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: <[email protected]>
To: <[email protected]>
Subject: Company Order #314159
Reply-To: <[email protected]>
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: <[email protected]>
To: <[email protected]>
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-To
and Reference
headers 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.Reply-To
is sadly not entirely reliable. All replies should have References:
which is better standardized than In-Reply-To:
which is not easily machine readable.
Your best bet may be to set the envelope header to a unique identifier, perhaps with a From:
and Sender:
combo that directs replies to the right place but displays nicely.
See also tangentially Dan Bernstein's notes; http://cr.yp.to/immhf.html and in particular http://cr.yp.to/immhf/thread.html
I don't think you can count on anything when it comes to forwards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With