Sample code for 30+ languages & platforms
C# Requires Chilkat v11.0.0+

Create a message disposition notification

See more Email Object Examples

An MDN describes a recipient-side event such as displaying a message. Create one only when the application has an appropriate request and the recipient has consented. Set Final-Recipient from the actual receiving mailbox. MDN format.

Chilkat C# Downloads

C#
bool success = false;

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

Chilkat.Email email = new Chilkat.Email();
success = email.LoadEml("message.eml");
if (success != true) {
    Debug.WriteLine(email.LastErrorText);
    return;
}

Chilkat.Xml fields = new Chilkat.Xml();
fields.Tag = "DispositionFields";
fields.NewChild2("Final-Recipient","rfc822; alex@example.net");
string originalId = email.GetHeaderField("Message-ID");
if (originalId != "") {
    fields.NewChild2("Original-Message-ID",originalId);
}

fields.NewChild2("Disposition","manual-action/MDN-sent-manually; displayed");
Chilkat.Email report = new Chilkat.Email();
success = email.ToMdn("The recipient displayed your message.",fields.GetXml(),true,report);
if (success != true) {
    Debug.WriteLine(email.LastErrorText);
    return;
}

report.From = "Alex Rivera <alex@example.net>";

success = report.SaveEml("disposition.eml");
if (success != true) {
    Debug.WriteLine(report.LastErrorText);
    return;
}

Debug.WriteLine("Saved disposition.eml.");