IMultipart |
public interface IMultipartReport : IMultipart, IMimeEntity, IDisposable, ICollection<MimeEntity>, IEnumerable<MimeEntity>, IEnumerable, IList<MimeEntity>
The IMultipartReport type exposes the following members.
Name | Description | |
---|---|---|
Boundary |
Get or set the boundary.
(Inherited from IMultipart) | |
ContentBase |
Get or set the base content URI.
(Inherited from IMimeEntity) | |
ContentDisposition |
Get or set the content disposition.
(Inherited from IMimeEntity) | |
ContentId |
Get or set the Content-Id.
(Inherited from IMimeEntity) | |
ContentLocation |
Get or set the content location.
(Inherited from IMimeEntity) | |
ContentType |
Get the type of the content.
(Inherited from IMimeEntity) | |
Count | (Inherited from ICollectionMimeEntity) | |
Epilogue |
Get or set the epilogue.
(Inherited from IMultipart) | |
Headers |
Get the list of headers.
(Inherited from IMimeEntity) | |
IsAttachment |
Get a value indicating whether this entity is an attachment.
(Inherited from IMimeEntity) | |
IsReadOnly | (Inherited from ICollectionMimeEntity) | |
Item | (Inherited from IListMimeEntity) | |
Preamble |
Get or set the preamble.
(Inherited from IMultipart) | |
ReportType | Get or set the type of the report. |
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; } } } }