Click or drag to resize
MimeKit

IMessageDeliveryStatus Interface

An interface for a message delivery status MIME part.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public interface IMessageDeliveryStatus : IMimePart, 
	IMimeEntity, IDisposable

The IMessageDeliveryStatus type exposes the following members.

Properties
 NameDescription
Public propertyCode exampleContent Get or set the MIME content.
(Inherited from IMimePart)
Public propertyContentBase Get or set the base content URI.
(Inherited from IMimeEntity)
Public propertyContentDescription Get or set the description of the content if available.
(Inherited from IMimePart)
Public propertyContentDisposition Get or set the content disposition.
(Inherited from IMimeEntity)
Public propertyContentDuration Get or set the duration of the content if available.
(Inherited from IMimePart)
Public propertyContentId Get or set the Content-Id.
(Inherited from IMimeEntity)
Public propertyContentLocation Get or set the content location.
(Inherited from IMimeEntity)
Public propertyContentMd5 Get or set the md5sum of the content.
(Inherited from IMimePart)
Public propertyContentTransferEncoding Get or set the content transfer encoding.
(Inherited from IMimePart)
Public propertyContentType Get the type of the content.
(Inherited from IMimeEntity)
Public propertyCode exampleFileName Get or set the name of the file.
(Inherited from IMimePart)
Public propertyHeaders Get the list of headers.
(Inherited from IMimeEntity)
Public propertyIsAttachment Get a value indicating whether this entity is an attachment.
(Inherited from IMimeEntity)
Public propertyCode exampleStatusGroups Get the groups of delivery status fields.
Top
Methods
 NameDescription
Public methodAccept Dispatches to the specific visit method for this MIME entity.
(Inherited from IMimeEntity)
Public methodComputeContentMd5 Compute the MD5 checksum of the content.
(Inherited from IMimePart)
Public methodDispose
(Inherited from IDisposable)
Public methodGetBestEncoding(EncodingConstraint, CancellationToken) Calculate the most efficient content encoding given the specified constraint.
(Inherited from IMimePart)
Public methodGetBestEncoding(EncodingConstraint, Int32, CancellationToken) Calculate the most efficient content encoding given the specified constraint.
(Inherited from IMimePart)
Public methodPrepare Prepare the MIME entity for transport using the specified encoding constraints.
(Inherited from IMimeEntity)
Public methodVerifyContentMd5 Verify the Content-Md5 value against an independently computed md5sum.
(Inherited from IMimePart)
Public methodWriteTo(Stream, CancellationToken) Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteTo(String, CancellationToken) Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteTo(FormatOptions, Stream, CancellationToken) Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteTo(FormatOptions, String, CancellationToken) Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteTo(Stream, Boolean, CancellationToken) Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteTo(String, Boolean, CancellationToken) Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteTo(FormatOptions, Stream, Boolean, CancellationToken) Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteTo(FormatOptions, String, Boolean, CancellationToken) Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteToAsync(Stream, CancellationToken) Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteToAsync(String, CancellationToken) Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteToAsync(FormatOptions, Stream, CancellationToken) Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteToAsync(FormatOptions, String, CancellationToken) Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteToAsync(Stream, Boolean, CancellationToken) Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteToAsync(String, Boolean, CancellationToken) Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Public methodWriteToAsync(FormatOptions, Stream, Boolean, CancellationToken) Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity)
Public methodWriteToAsync(FormatOptions, String, Boolean, CancellationToken) Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity)
Top
Remarks

A message delivery status MIME part is a machine readable notification denoting the delivery status of a message and has a MIME-type of message/delivery-status.

For more information, see rfc3464.

Example
C#
public void ProcessDeliveryStatusNotification (MimeMessage message)
{
    var report = message.Body as MultipartReport;

    if (report == null || report.ReportType == null || !report.ReportType.Equals ("delivery-status", StringComparison.OrdinalIgnoreCase)) {
        // this is not a delivery status notification message...
        return;
    }

    // process the report
    foreach (var mds in report.OfType<MessageDeliveryStatus> ()) {
        // process the status groups - each status group represents a different recipient

        // The first status group contains information about the message
        var envelopeId = mds.StatusGroups[0]["Original-Envelope-Id"];

        // all of the other status groups contain per-recipient information
        for (int i = 1; i < mds.StatusGroups.Length; i++) {
            var recipient = mds.StatusGroups[i]["Original-Recipient"];
            var action = mds.StatusGroups[i]["Action"];

            if (recipient == null)
                recipient = mds.StatusGroups[i]["Final-Recipient"];

            // the recipient string should be in the form: "rfc822;user@domain.com"
            var index = recipient.IndexOf (';');
            var address = recipient.Substring (index + 1);

            switch (action) {
            case "failed":
                Console.WriteLine ("Delivery of message {0} failed for {1}", envelopeId, address);
                break;
            case "delayed":
                Console.WriteLine ("Delivery of message {0} has been delayed for {1}", envelopeId, address);
                break;
            case "delivered":
                Console.WriteLine ("Delivery of message {0} has been delivered to {1}", envelopeId, address);
                break;
            case "relayed":
                Console.WriteLine ("Delivery of message {0} has been relayed for {1}", envelopeId, address);
                break;
            case "expanded":
                Console.WriteLine ("Delivery of message {0} has been delivered to {1} and relayed to the the expanded recipients", envelopeId, address);
                break;
            }
        }
    }
}
See Also