(JavaScript) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message). Note: This example requires Chilkat v11.0.0 or greater.
var success = false;
var email = new CkEmail();
// Load an email from a .eml
success = email.LoadEml("embeddedEmail.eml");
if (success == false) {
console.log(email.LastErrorText);
return;
}
// Display how many attached emails are embedded within
// this one:
var numAttached = email.NumAttachedMessages;
console.log("numAttached = " + numAttached);
// Get the 1st attached message.
var email2 = new CkEmail();
success = email.GetAttachedEmail(0,email2);
if (success == true) {
// Display the subject, From, and a header field...
console.log(email2.Subject);
console.log(email2.From);
console.log(email2.GetHeaderField("X-SOMETHING"));
}
|