Represents a Delivery Status Notification attachment in RFC 1894 format.
For a list of all members of this type, see DsnAttachment Members.
System.Object
MailBee.BounceMail.DsnAttachment
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
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 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 method.
[C#] // 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("------------------------------------------------------------"); } }
[Visual Basic] ' To use the code below, import these namespaces at the top of your code. Imports System Imports System.IO Imports MailBee.Mime Imports MailBee.BounceMail Class Sample Shared Sub Main(ByVal args() As String) ' Assume that MimePart object is already set. Dim part As MimePart = ... Dim dsnAttach As DsnAttachment = New DsnAttachment(New Attachment(part), Nothing) Console.WriteLine("------------------ DSN attachment as text ------------------") Console.WriteLine(dsnAttach.ToString()) Console.WriteLine("--------------- DSN headers as StringDictionary ------------") For Each key As String In dsnAttach.Items.Keys Console.WriteLine("Dsn item: {0} = {1}", key, dsnAttach.Items(key)) Next Console.WriteLine("------------------------------------------------------------") End Sub End Class
Namespace: MailBee.BounceMail
Assembly: MailBee.NET (in MailBee.NET.dll)
DsnAttachment Members | MailBee.BounceMail Namespace | DsnRecipient