Wednesday, April 30, 2008

Adding Info to Email Header

Adding custom info to email header is very simple in .Net. This info can be used to identify/trace the emails back to some business objects. In case the email is bounced back you can easily track the email and act on it. Encrypting that custom info makes it even more secure. Here is how you add the custom piece of information:

//create a new smtp mail message
System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage();
:
:
mailMessage.Headers.Add("AdditionalInfo", "Some Info");
:
:
//Send the mail.

smtpClient.Send(mailMessage);


Happy Coding,

Madhu

No comments: