PowerTCP Mail for .NET
DeliveryStatusNotification Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : DeliveryStatusNotification Class




The DeliveryStatusNotification class provides an easy way to handle Delivery Status Notification (DSN) when sending mail using SMTP.

Object Model

DeliveryStatusNotification Class

Syntax

Visual Basic (Declaration) 
Public Class DeliveryStatusNotification 
Visual Basic (Usage)Copy Code
Dim instance As DeliveryStatusNotification
C# 
public class DeliveryStatusNotification 
Managed Extensions for C++ 
public __gc class DeliveryStatusNotification 
C++/CLI 
public ref class DeliveryStatusNotification 

Example

The following example demonstrates using the DeliveryStatusNotification class to send an email with DSN.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Specify a DSN ID to use.
Smtp1.DSN.EnvelopeID = "ID1234567"

' Specify to return the entire message instead of the headers.
Smtp1.DSN.ReturnMessage = True

' Send a DSN on failure or delay.
Smtp1.DSN.Type = DSNType.Delay Or DSNType.Failure

' Send a message
Smtp1.Server = "mail@test.com"
Smtp1.Send("you@test.com", "me@test.com", "Test", "test message")
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Specify a DSN ID to use.
smtp1.DSN.EnvelopeID = "ID1234567";

// Specify to return the entire message instead of the headers.
smtp1.DSN.ReturnMessage = true;

// Send a DSN on failure or delay.
smtp1.DSN.Type = DSNType.Delay | DSNType.Failure; 

// Send a message
smtp1.Server = "mail.test.com";
smtp1.Send("you@test.com", "me@test.com", "Test", "test message");

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:

  • A NOTIFY parameter (appended to RCPT command) to specify under what conditions the sender should be notified (NEVER, SUCCESS, FAILURE, or DELAY).
  • A RET parameter (appended to MAIL command) to specify whether or not the message should be included in the DSN.
  • A ENVID parameter (appended to MAIL command) specifying an envelope identifier to be transmitted with the DSN.
  • A ORCPT parameter (appended to RCPT command) specifying the original recipient.

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

  • Set DeliveryStatusNotification.Type to specify under what conditions a DSN should be sent (DSNType.Default, DSNType.Delay, DSNType.Failure, DSNType.Never, or DSNType.Success).
  • Set DeliveryStatusNotification.ReturnMessage to true to specify that the entire message should be included with the DSN, and false if only the header should be included.
  • Set DeliveryStatusNotification.EnvelopeID to the envelope identifier to be transmitted with the DSN.

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.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.DeliveryStatusNotification

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.