Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to maintain/preserve Custom Email Headers(X-header) when replying

i am using following code to send an email from my .NET application ,here i have added custom header X-Company. When the email is received i get this custom header properly but whenever i reply/forward this mail Custom Headers not getting back.

MailMessage message = new MailMessage(From, To);                  
                message.Headers.Add("X-Company","xyz");                
                message.Body = emailMessage.ToString();
                message.Subject = Subject;                
                message.IsBodyHtml = true;               
                smtp.Send(message);
like image 439
Sami Avatar asked Sep 11 '12 14:09

Sami


1 Answers

This would be very hard to do across all email clients as they are free to strip away headers that they deem unnecessary when you do a reply to.

If your sole goal is to insert some key value pair and have it return back to you whenever somebody does a reply to, As you are doing HTML email you can have a hidden html element in which you have your custom header information.

like image 104
parapura rajkumar Avatar answered Oct 26 '22 09:10

parapura rajkumar