Click or drag to resize
MimeKit

MultipartReport Class

A multipart/report MIME entity.
Inheritance Hierarchy

Namespace:  MimeKit
Assembly:  MimeKit (in MimeKit.dll) Version: 2.2.0
Syntax
C#
public class MultipartReport : Multipart

The MultipartReport type exposes the following members.

Constructors
  NameDescription
Public methodMultipartReport(String)
Initializes a new instance of the MultipartReport class.
Public methodMultipartReport(MimeEntityConstructorArgs)
Initializes a new instance of the MultipartReport class.
Public methodMultipartReport(String, Object)
Initializes a new instance of the MultipartReport class.
Top
Properties
  NameDescription
Public propertyBoundary
Gets or sets the boundary.
(Inherited from Multipart.)
Public propertyContentBase
Gets or sets the base content URI.
(Inherited from MimeEntity.)
Public propertyContentDisposition
Gets or sets the content disposition.
(Inherited from MimeEntity.)
Public propertyContentId
Gets or sets the content identifier.
(Inherited from MimeEntity.)
Public propertyContentLocation
Gets or sets the content location.
(Inherited from MimeEntity.)
Public propertyContentType
Gets the type of the content.
(Inherited from MimeEntity.)
Public propertyCount
Gets the number of parts in the multipart.
(Inherited from Multipart.)
Public propertyEpilogue
Gets or sets the epilogue.
(Inherited from Multipart.)
Public propertyHeaders
Gets the list of headers.
(Inherited from MimeEntity.)
Public propertyIsAttachment
Gets a value indicating whether this MimePart is an attachment.
(Inherited from MimeEntity.)
Public propertyIsReadOnly
Gets a value indicating whether this instance is read only.
(Inherited from Multipart.)
Public propertyItem
Gets or sets the MimeEntity at the specified index.
(Inherited from Multipart.)
Public propertyPreamble
Gets or sets the preamble.
(Inherited from Multipart.)
Public propertyCode exampleReportType
Gets or sets the type of the report.
Top
Methods
  NameDescription
Public methodAccept
Dispatches to the specific visit method for this MIME entity.
(Overrides MultipartAccept(MimeVisitor).)
Public methodAdd
Adds the specified part.
(Inherited from Multipart.)
Public methodClear
Clears the multipart.
(Inherited from Multipart.)
Public methodContains
Checks if the Multipart contains the specified part.
(Inherited from Multipart.)
Public methodCopyTo
Copies all of the entities in the Multipart to the specified array.
(Inherited from Multipart.)
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 methodGetEnumerator
Gets the enumerator for the children of the Multipart.
(Inherited from Multipart.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Gets the index of the specified part.
(Inherited from Multipart.)
Public methodInsert
Inserts the part at the specified index.
(Inherited from Multipart.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnHeadersChanged
Called when the headers change in some way.
(Inherited from MimeEntity.)
Public methodPrepare
Prepare the MIME entity for transport using the specified encoding constraints.
(Inherited from Multipart.)
Public methodRemove
Removes the specified part.
(Inherited from Multipart.)
Public methodRemoveAt
Removes the part at the specified index.
(Inherited from Multipart.)
Protected methodRemoveHeader
Removes the header.
(Inherited from MimeEntity.)
Protected methodSetHeader(String, Byte)
Sets the header using the raw value.
(Inherited from MimeEntity.)
Protected methodSetHeader(String, String)
Sets the header.
(Inherited from MimeEntity.)
Public methodToString
Returns a String that represents the current MimeEntity.
(Inherited from MimeEntity.)
Protected methodTryInit
Tries to use the given object to initialize the appropriate property.
(Inherited from MimeEntity.)
Public methodWriteTo(Stream, CancellationToken)
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteTo(String, CancellationToken)
Writes the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteTo(Stream, Boolean, CancellationToken)
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteTo(String, Boolean, CancellationToken)
Write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteTo(FormatOptions, Stream, CancellationToken)
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteTo(FormatOptions, String, CancellationToken)
Write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteTo(FormatOptions, String, Boolean, CancellationToken)
Write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteTo(FormatOptions, Stream, Boolean, CancellationToken)
Writes the Multipart to the specified output stream.
(Inherited from Multipart.)
Public methodWriteToAsync(Stream, CancellationToken)
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteToAsync(String, CancellationToken)
Asynchronously writes the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteToAsync(Stream, Boolean, CancellationToken)
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteToAsync(String, Boolean, CancellationToken)
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteToAsync(FormatOptions, Stream, CancellationToken)
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity.)
Public methodWriteToAsync(FormatOptions, String, CancellationToken)
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteToAsync(FormatOptions, String, Boolean, CancellationToken)
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity.)
Public methodWriteToAsync(FormatOptions, Stream, Boolean, CancellationToken)
Asynchronously writes the Multipart to the specified output stream.
(Inherited from Multipart.)
Top
Remarks
A multipart/related MIME entity is a general container part for electronic mail reports of any kind.
Examples
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