I need to create a correlation between an outgoing e-mail to a reply e-mail without changing the subject or body.
I've tried to add some headers to an SMTP outgoing mail:
var outgoingMessage = new System.Net.Mail.MailMessage();
mail.Headers.Add("Tag","MyNewTag");
mail.Headers.Add("CorrelationID","MyNewCorrID");
Unfortunately, when replying to that email message - those headers are gone.
Is there any way to correlate between outgoing and incoming message without interfering subject or body ?
For the headers you should probably use X-headers instead:
mail.Headers.Add("X-Tag","MyNewTag");
mail.Headers.Add("X-CorrelationID","MyNewCorrID");
To correlate between outgoing and incoming message without interfering subject or body, you could also check the References: header (only with reply, not with forward).
This header contains the Message-ID('s) of the originating messages:
References: <some-id@domain>
There is also the In-Reply-To header.
To add more information you could even customize the outgoing Message-ID.
Maybe the Thread-Index header could be helpful too.
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