DsnAttachment Class |
Namespace: MailBee.BounceMail
The DsnAttachment type exposes the following members.
Name | Description | |
---|---|---|
DsnAttachment |
Creates a new instance of DsnAttachment class from the specified
attachment.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString |
Returns the DSN attachment contents as a string.
(Overrides ObjectToString.) |
Name | Description | |
---|---|---|
ArrivalDate |
Gets the message arrival date.
| |
ArrivalDateAsString |
Gets the message arrival date as string.
| |
DsnGatewayName |
Gets the DSN gateway name.
| |
DsnGatewayType |
Gets the DSN gateway type.
| |
Items |
Gets the list of all fields in the DSN attachment.
| |
OriginalEnvelopeID |
Gets the original envelope ID.
| |
ReceivedFromMtaName |
Gets the name of the MTA from which the message was received.
| |
ReceivedFromMtaType |
Gets the type of the MTA from which the message was received.
| |
Recipients |
Gets the list of the delivery statuses of the original e-mail message
to its recipients.
| |
ReportingMtaName |
Gets the reporting MTA name.
| |
ReportingMtaType |
Gets the reporting MTA type.
|
Although there is no single standard for Delivery Status Notification (DSN), the format described in RFC 1894 is the most popular. Also, many bounced messages of proprietary formats include RFC 1894 DSN as attachment. This means a bounced message can contain duplicated information: in the main body and in RFC 1894 DSN attachment.
Thus, a DSN message may include or not include DSN attachment. DsnAttachment object deals with DSN attachments only.
In most cases, there is no need to create DsnAttachment directly. You can use Process(MailMessage) method and examine each RecipientStatus of Recipients collection of the returned Result object.
RecipientStatus object provides DsnInfo property which returns DsnAttachment object (if the message includes a DSN attachment). For instance, you can use it to get OriginalEnvelopeID of the message.
You may, however, need to create DsnAttachment object manually if you got RFC 1894 DSN data from another source, not from MailMessage object.
The most important properties are Recipients (which contains delivery status and other details for each recipient listed in the DSN) and Items which provides direct access to all fields of the DSN.
// To use the code below, import these namespaces at the top of your code. using System; using System.IO; using MailBee.Mime; using MailBee.BounceMail; class Sample { static void Main(string[] args) { // Assume that MimePart object is already set. MimePart part = ...; DsnAttachment dsnAttach = new DsnAttachment(new Attachment(part), null); Console.WriteLine("------------------ DSN attachment as text ------------------"); Console.WriteLine(dsnAttach.ToString()); Console.WriteLine("--------------- DSN headers as StringDictionary ------------"); foreach (string key in dsnAttach.Items.Keys) { Console.WriteLine("DSN item: {0} = {1}", key, dsnAttach.Items[key]); } Console.WriteLine("------------------------------------------------------------"); } }