JavaScript Requires Chilkat v11.0.0+
JavaScript
Read messages attached to another email
See more Email Object Examples
Load the wrapper from the preceding example and read the author and subject of each message/rfc822 part. Ordinary files are counted separately by NumAttachments.
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("correspondence.eml");
if (success !== true) {
console.log(email.LastErrorText);
return;
}
console.log("Attached messages: " + email.NumAttachedMessages);
var nested = new CkEmail();
var i = 0;
while ((i < email.NumAttachedMessages)) {
success = email.GetAttachedEmail(i,nested);
if (success !== true) {
console.log(email.LastErrorText);
return;
}
console.log(nested.From + " " + nested.Subject);
i = i+1;
}