IMessage Delivery Status Interface
An interface for a message delivery status MIME part.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public interface IMessageDeliveryStatus : IMimePart,
IMimeEntity, IDisposable- Implements
- IMimeEntity, IMimePart, IDisposable
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;
}
}
}
}
Properties
| Content |
Get or set the MIME content.
(Inherited from IMimePart) |
| ContentBase |
Get or set the base content URI.
(Inherited from IMimeEntity) |
| ContentDescription |
Get or set the description of the content if available.
(Inherited from IMimePart) |
| ContentDisposition |
Get or set the content disposition.
(Inherited from IMimeEntity) |
| ContentDuration |
Get or set the duration of the content if available.
(Inherited from IMimePart) |
| ContentId |
Get or set the Content-Id.
(Inherited from IMimeEntity) |
| ContentLocation |
Get or set the content location.
(Inherited from IMimeEntity) |
| ContentMd5 |
Get or set the md5sum of the content.
(Inherited from IMimePart) |
| ContentTransferEncoding |
Get or set the content transfer encoding.
(Inherited from IMimePart) |
| ContentType |
Get the type of the content.
(Inherited from IMimeEntity) |
| FileName |
Get or set the name of the file.
(Inherited from IMimePart) |
| Headers |
Get the list of headers.
(Inherited from IMimeEntity) |
| IsAttachment |
Get a value indicating whether this entity is an attachment.
(Inherited from IMimeEntity) |
| StatusGroups | Get the groups of delivery status fields. |
Methods
| Accept |
Dispatches to the specific visit method for this MIME entity.
(Inherited from IMimeEntity) |
| ComputeContentMd5 |
Compute the MD5 checksum of the content.
(Inherited from IMimePart) |
| Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable) |
| GetBestEncoding(EncodingConstraint, CancellationToken) |
Calculate the most efficient content encoding given the specified constraint.
(Inherited from IMimePart) |
| GetBestEncoding(EncodingConstraint, Int32, CancellationToken) |
Calculate the most efficient content encoding given the specified constraint.
(Inherited from IMimePart) |
| Prepare |
Prepare the MIME entity for transport using the specified encoding constraints.
(Inherited from IMimeEntity) |
| VerifyContentMd5 |
Verify the Content-Md5 value against an independently computed md5sum.
(Inherited from IMimePart) |
| WriteTo(Stream, CancellationToken) |
Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteTo(String, CancellationToken) |
Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteTo(FormatOptions, Stream, CancellationToken) |
Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteTo(FormatOptions, String, CancellationToken) |
Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteTo(Stream, Boolean, CancellationToken) |
Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteTo(String, Boolean, CancellationToken) |
Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteTo(FormatOptions, Stream, Boolean, CancellationToken) |
Write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteTo(FormatOptions, String, Boolean, CancellationToken) |
Write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteToAsync(Stream, CancellationToken) |
Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteToAsync(String, CancellationToken) |
Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteToAsync(FormatOptions, Stream, CancellationToken) |
Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteToAsync(FormatOptions, String, CancellationToken) |
Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteToAsync(Stream, Boolean, CancellationToken) |
Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteToAsync(String, Boolean, CancellationToken) |
Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |
| WriteToAsync(FormatOptions, Stream, Boolean, CancellationToken) |
Asynchronously write the IMimeEntity to the specified output stream.
(Inherited from IMimeEntity) |
| WriteToAsync(FormatOptions, String, Boolean, CancellationToken) |
Asynchronously write the IMimeEntity to the specified file.
(Inherited from IMimeEntity) |