[ACCEPTED]-Which headers are ALWAYS returned in a reply/forward?-smtp

Accepted answer
Score: 16

You can't rely entirely on headers being 9 preserved. When replying or forwarding, a 8 mail client creates a new message; that 7 mail client can quite legitimately ignore 6 or alter any content, as deemed appropriate.

You 5 might be able to track by the following 4 means, but all are vulnerable to alteration 3 (mainly by the user, but also by a primitive 2 mail client). You should really just use 1 them to make a best-guess.

  1. A disposable Reply-To address. Theoretically, you can also do it with "From" if you want, but Reply-To is better to ensure the user (and their mail server/client) recognise it's from you and act appropriately. I see no reason why a spam filter would care about disposable addresses. Seeing as most spam uses fake addresses anyway and doesn't care about replies, it is not really a spammer trick. It's unlikely to cause a substantial increase in spam filtering. Using a Reply-To for the same domain as your From address is also unlikely to look suspicious.
  2. A unique subject. Yes, it can easily be changed, but usually the existing subject is appended to, rather than deleted (especially if it obviously contains some kind of reference number). You could apply a regular expression match - maybe only using it as a confirmation of your other detection methods.
  3. A unique string in the body (possibly preceded by the words "DO NOT REMOVE THIS LINE")
  4. The 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.
Score: 2

Reply-To is sadly not entirely reliable. All replies 9 should have References: which is better standardized 8 than In-Reply-To: which is not easily machine readable.

Your 7 best bet may be to set the envelope header 6 to a unique identifier, perhaps with a From: and 5 Sender: combo that directs replies to the right 4 place but displays nicely.

See also tangentially 3 Dan Bernstein's notes; http://cr.yp.to/immhf.html and in particular 2 http://cr.yp.to/immhf/thread.html

I don't think you can count on anything when it 1 comes to forwards.

Score: 0

Although you have already received some 10 answers, however, we had a similar situation 9 where we supposed to send emails to customers 8 and read them back and associated them with 7 various activities.

During the research the 6 the only HEADER we found that does not get 5 replaced or Removed by the various email 4 clients (Outook, Yahoo, Gmail etc.) was 3 "XREF". We have thoroughly tested it and 2 it has been working since we first introduced 1 it.

More Related questions