Some DSN (Delivery Status Notification) messages embed the original messages as files. To access the original message, you will need to load it from the attachment and after that you can manipulate the loaded message normally. The following example shows you how to use the MailMessage class to access the original message:
using System; using ComponentPro.Net.Mail; ... // Create a new instance of the BounceInspector class. BounceInspector inspector = new BounceInspector(); // Process an EML file (you should change the file name here). BounceResult r = inspector.Process("C:\\ComponentPro\\NetProducts\\Branches\\2009v4\\UltimateBounceInspector\\UnitTest\\Data\\FB043DC5B1CC4DD092056CEE1E47AEC9.eml"); // If this message was identified as a bounced email message. if (r.Identified) { Console.WriteLine("To E-mail: {0}\r\nFrom E-mail: {1}\r\nBounced E-mail: {2}\r\nBounce Category: {3}\r\nBounce Type {4}", r.MailMessage.To[0].Address, r.MailMessage.From[0].Address, r.Addresses, r.BounceCategory, r.BounceType); // If it contains attachments. if (r.MailMessage.Attachments.Count > 0) { foreach (Attachment at in r.MailMessage.Attachments) { // Try to find the orginal message. if (at.FileName.EndsWith(".eml", StringComparison.InvariantCultureIgnoreCase)) { // Create a new MailMessage object from the attachment. MailMessage msg = new MailMessage(at.GetContentStream()); // Print out all name value pairs in the message headers. foreach (Header header in msg.Headers) { Console.WriteLine("Header Name: {0}, Value: {1}", header.Name, header.Raw); // Do something here. // ... } } } } } else Console.WriteLine("No bounce information found");