DsnAttachment Class
Represents a Delivery Status Notification attachment in RFC 1894 format.
Inheritance Hierarchy

Namespace: MailBee.BounceMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public class DsnAttachment

The DsnAttachment type exposes the following members.

Public methodDsnAttachment
Creates a new instance of DsnAttachment class from the specified attachment.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns the DSN attachment contents as a string.
(Overrides ObjectToString.)
Public propertyArrivalDate
Gets the message arrival date.
Public propertyArrivalDateAsString
Gets the message arrival date as string.
Public propertyDsnGatewayName
Gets the DSN gateway name.
Public propertyDsnGatewayType
Gets the DSN gateway type.
Public propertyCode exampleItems
Gets the list of all fields in the DSN attachment.
Public propertyOriginalEnvelopeID
Gets the original envelope ID.
Public propertyReceivedFromMtaName
Gets the name of the MTA from which the message was received.
Public propertyReceivedFromMtaType
Gets the type of the MTA from which the message was received.
Public propertyRecipients
Gets the list of the delivery statuses of the original e-mail message to its recipients.
Public propertyReportingMtaName
Gets the reporting MTA name.
Public propertyReportingMtaType
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.

This sample converts a MimePart into DsnAttachment object and displays some of its properties. For brevity, we assume MimePart object is already available to the application. For instance, you can create it from byte array using Parse(Byte) method.
// 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("--------------- DSN headers as StringDictionary ------------");
        foreach (string key in dsnAttach.Items.Keys)
            Console.WriteLine("DSN item: {0} = {1}", key, dsnAttach.Items[key]);
See Also