PowerTCP Mail for .NET
DeliveryStatusNotification Class
Members  Example 




Specifies the Delivery Status Notification (DSN) options to use when sending mail using SMTP.
Object Model
DeliveryStatusNotification Class
Syntax
Public Class DeliveryStatusNotification 
Dim instance As DeliveryStatusNotification
public class DeliveryStatusNotification 
public __gc class DeliveryStatusNotification 
public ref class DeliveryStatusNotification 
Remarks

Because in the original SMTP specification the support for notification of the success or failure of a sent message was quite limited, RFC 1891 defined an extension to the SMTP protocol to allow for Delivery Status Notification, or DSN. DSN allows much greater control over what conditions should the sender be notified and the construction of the notification itself. This was achieved by extending the SMTP RCPT and MAIL commands to allow the specification of notification parameters. These parameters include:

The properties of the DeliveryStatusNotification object control the use of these parameters:

Once the properties of the DeliveryStatusNotification object have been set, all DSN related communication will occur transparently. The ORCPT parameter is automatically added and set to the recipient.

Example
This example demonstrates sending a message with Delivery Status Notification (DSN).
using System.Net.Mail;

private void sendWithDsn()
{
    //Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567";

    //Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = true;

    //Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay | DeliveryNotificationOptions.OnFailure;

    //Send a message
    smtp1.Session.RemoteEndPoint = new IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session));
    smtp1.Session.Username = myUsername;
    smtp1.Session.Password = myPassword;
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.");
    //Gracefully logout
    smtp1.Close();
}
Imports System.Net.Mail

Private Sub sendWithDsn()
    'Specify a DSN ID to use
    smtp1.DeliveryStatusNotification.EnvelopeID = "ID1234567"

    'Return the entire message instead of the headers
    smtp1.DeliveryStatusNotification.ReturnMessage = True

    'Send a DSN on failure or delay
    smtp1.DeliveryStatusNotification.Options = DeliveryNotificationOptions.Delay Or DeliveryNotificationOptions.OnFailure

    'Send a message
    smtp1.Session.RemoteEndPoint = New IPEndPoint(myServer, Smtp.GetDefaultPort(smtp1.Session))
    smtp1.Session.Username = myUsername
    smtp1.Session.Password = myPassword
    smtp1.Send(toAddress, fromAddress, "Test", "Test Message.")
    'Gracefully logout
    smtp1.Close()
End Sub
Inheritance Hierarchy

System.Object
   Dart.Mail.DeliveryStatusNotification

See Also

Reference

DeliveryStatusNotification Members
Dart.Mail Namespace


PowerTCP Mail for .NET Documentation Version 4.3
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic