|
Hi, i'have the below question. I send an mail with an attached file to an invalid sender. After that i received a mail related to a not delivery report. The problem is. I need to read the attach file in order to get some information. The questions are: I noticed that in the reply message i have all message i sent. Can i read the attach file from the notification delivery mail? I noticed that i've the MessageId from the original mail. Can i find a mail using MessageId as filter criteria? Best Regards Enrico |
|
1) Once you have a MailMessage object which contains the non-delivery report, you can use the following code to extract the original message from it:
Please note that not all non-delivery reports contain the full original message. Some only contain its headers and some don't contain it at all. 2) We have written a simple class that makes it easy to parse the delivery status part of a non-delivery report get it from. (The code is written in C# but if you prefer VB.NET, let us know and we will convert it for you). Using it in custom applications is simple - for example:
The class parses both delivery status notification messages (which includes NDR messages) and disposition notification messages that are similar. Use DeliveryStatus object's OriginalMessageId to get the MessageId of the original message. 3) What do you mean by "find a mail using MessageId as filter criteria", exactly? Do you mean using Imap object's Search method? If that's the case, I don't think that's possible, unfortunately. However, you can at least search for all delivery status notification messages using the following code:
Additionally, you can add a ImapSearchParameter.Sent(...) filter to only search for messages that arrived recently. |