Click or drag to resize
MimeKit

IMultipartReport Interface

An interface for a multipart/report MIME entity.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public interface IMultipartReport : IMultipart, 
	IMimeEntity, IDisposable, ICollection<MimeEntity>, IEnumerable<MimeEntity>, 
	IEnumerable, IList<MimeEntity>

The IMultipartReport type exposes the following members.

Properties
 NameDescription
Public propertyBoundary Get or set the boundary.
(Inherited from IMultipart)
Public propertyContentBase Get or set the base content URI.
(Inherited from IMimeEntity)
Public propertyContentDisposition Get or set the content disposition.
(Inherited from IMimeEntity)
Public propertyContentId Get or set the Content-Id.
(Inherited from IMimeEntity)
Public propertyContentLocation Get or set the content location.
(Inherited from IMimeEntity)
Public propertyContentType Get the type of the content.
(Inherited from IMimeEntity)
Public propertyCount
(Inherited from ICollectionMimeEntity)
Public propertyEpilogue Get or set the epilogue.
(Inherited from IMultipart)
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 propertyIsReadOnly
(Inherited from ICollectionMimeEntity)
Public propertyItem
(Inherited from IListMimeEntity)
Public propertyPreamble Get or set the preamble.
(Inherited from IMultipart)
Public propertyCode exampleReportType Get or set the type of the report.
Top
Methods
 NameDescription
Public methodAccept Dispatches to the specific visit method for this MIME entity.
(Inherited from IMimeEntity)
Public methodAdd
(Inherited from ICollectionMimeEntity)
Public methodClear
(Inherited from ICollectionMimeEntity)
Public methodContains
(Inherited from ICollectionMimeEntity)
Public methodCopyTo
(Inherited from ICollectionMimeEntity)
Public methodDispose
(Inherited from IDisposable)
Public methodGetEnumerator
(Inherited from IEnumerableMimeEntity)
Public methodIndexOf
(Inherited from IListMimeEntity)
Public methodInsert
(Inherited from IListMimeEntity)
Public methodPrepare Prepare the MIME entity for transport using the specified encoding constraints.
(Inherited from IMimeEntity)
Public methodRemove
(Inherited from ICollectionMimeEntity)
Public methodRemoveAt
(Inherited from IListMimeEntity)
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 multipart/related MIME entity is a general container part for electronic mail reports of any kind.
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