DeliveryNotificationOptions Class
Provides properties and methods which control how and when ESMTP Delivery Status Notifications (DSN) are sent.
Inheritance Hierarchy
SystemObject
  MailBee.SmtpMailDeliveryNotificationOptions

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public class DeliveryNotificationOptions

The DeliveryNotificationOptions type exposes the following members.

Methods
  NameDescription
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 methodReset
Resets all Delivery Status Notification settings back to defaults.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyNotifyCondition
Gets or sets the events that trigger ESMTP server to send delivery status notification back to the sender of the message.
Public propertyReturnPortion
Gets or sets how much of the original message is returned with the delivery status notification when the message delivery fails.
Public propertyTrackingID
Gets or sets the unique string (called message transmission envelope) which will be returned with delivery status notification messages.
Top
Remarks

To access DeliveryNotificationOptions object, use Smtp.DeliveryNotification property.

Note Note
If the SMTP server does not support DSN, the values of all the properties of this class are ignored.
Examples
This sample checks whether the server supports DSN's, submits a message to the server, and tells the server to send DSN on any outcome (sent successfully, failed, or delayed). The DSN message will include the header of the original message.
// To use the code below, import these namespaces at the top of your code
using System;
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();

// Set Delivery Status Notification settings:

// Notify always.
mailer.DeliveryNotification.NotifyCondition = DsnNotifyCondition.Always;

// Notification message will include the message header of the original messsage.
mailer.DeliveryNotification.ReturnPortion = DsnReturnPortion.Header;

// Specify some unique string which will be added to notification messages.
// It can then be used to match notification message with the original message.
mailer.DeliveryNotification.TrackingID = "UNQIUE_STRING_q8sdf74d";

// Set the message fields.
mailer.From.AsString = "John Doe <jdoe@domain1.com>";
mailer.To.AsString = "Bill Smith <b.smith@domain2.com>";
mailer.Subject = "Test message";

// Specify SMTP server to use. If your server does not require authentication,
// just remove last 2 parameters.
mailer.SmtpServers.Add("smtp.domain1.com", "jdoe", "secret");

// Connect to the server and say hello. We need this in order to learn the server
// capabilities (such as DSN support).
// Alternatively, we could not call Hello() and move DSN status check after Send(),
// since Send() method would automatically call Hello() if needed.
mailer.Connect();
mailer.Hello();

// Learn if delivery status notifications are supported by the server.
if (mailer.GetExtension("DSN") != null)
{
    Console.WriteLine("The message will be submitted with DSN support");
}
else
{
    Console.WriteLine("The message will be submitted without DSN support");
}

// Send the message.
mailer.Send();

Console.WriteLine("The message was successfully submitted to the server.");

// Close the connection.
mailer.Disconnect();
See Also