Click or drag to resize
MimeKit

MimeIterator Constructor

Initialize a new instance of the MimeIterator class.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public MimeIterator(
	MimeMessage message
)

Parameters

message  MimeMessage
The message.
Exceptions
ExceptionCondition
ArgumentNullExceptionmessage is null.
Remarks
Creates a new MimeIterator for the specified message.
Example
C#
var attachments = new List<MimePart> ();
var multiparts = new List<Multipart> ();

using (var iter = new MimeIterator (message)) {
    // collect our list of attachments and their parent multiparts
    while (iter.MoveNext ()) {
        var multipart = iter.Parent as Multipart;
        var part = iter.Current as MimePart;

        if (multipart != null && part != null && part.IsAttachment) {
            // keep track of each attachment's parent multipart
            multiparts.Add (multipart);
            attachments.Add (part);
        }
    }
}

// now remove each attachment from its parent multipart...
for (int i = 0; i < attachments.Count; i++)
    multiparts[i].Remove (attachments[i]);
See Also