JavaScript Requires Chilkat v11.0.0+
JavaScript
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.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat
v11.4.0 or greater.
var success = false;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
var email = new CkEmail();
success = email.LoadEml("message.eml");
if (success !== true) {
console.log(email.LastErrorText);
return;
}
var fields = new CkXml();
fields.Tag = "DispositionFields";
fields.NewChild2("Final-Recipient","rfc822; alex@example.net");
var originalId = email.GetHeaderField("Message-ID");
if (originalId !== "") {
fields.NewChild2("Original-Message-ID",originalId);
}
fields.NewChild2("Disposition","manual-action/MDN-sent-manually; displayed");
var report = new CkEmail();
success = email.ToMdn("The recipient displayed your message.",fields.GetXml(),true,report);
if (success !== true) {
console.log(email.LastErrorText);
return;
}
report.From = "Alex Rivera <alex@example.net>";
success = report.SaveEml("disposition.eml");
if (success !== true) {
console.log(report.LastErrorText);
return;
}
console.log("Saved disposition.eml.");