As Bill Shannon notes, arbitrary message headers would not be included in the reply. Realistically, the subject may be fundamentally similar in a reply. It will often be a prefixed version (for example, with "Re:") of the subject of the original message. Users, of course, can edit the subject, and broken mailers may do all sorts of crazy things.
You should be able to correlate a message reply with the original message by use of the References
header on the reply. This header should contain RFC 2822, as its last element, the message ID of the message that is being replied to. You can, in theory, even track multiple replies back to the original message, as References
should build up such that you can build the entire thread from the message ID list.
That is to say, when you send your original message, you should have a field:
Message-ID: <unique-message-id>
and in the reply, you should see:
References: <unique-message-id>
If, for some reason, you wish to use a different unique ID to track on, different from the message ID, you could also put that in your references list:
Message-ID: <unique-message-id>
References: <other-id>
and in replies, you should see:
References: <other-id> <unique-message-id>
Note that I said "should" repeatedly. This behavior was only codified in RFC2822, the behavior of the References
header is poorly defined in the original RFC822. While (presumably) most mail clients follow RFC2822, you can see a list of (hopefully mostly outdated) caveats explained by jwz regarding the threading algorithm in Netscape's mail reader.