(C#) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
Chilkat.Email email = new Chilkat.Email();
// Load an email from a .eml
bool success = email.LoadEml("embeddedEmail.eml");
if (success != true) {
Debug.WriteLine(email.LastErrorText);
return;
}
// Display how many attached emails are embedded within
// this one:
int numAttached = email.NumAttachedMessages;
Debug.WriteLine("numAttached = " + Convert.ToString(numAttached));
// Get the 1st attached message.
Chilkat.Email email2 = null;
email2 = email.GetAttachedMessage(0);
if (email.LastMethodSuccess == true) {
// Display the subject, From, and a header field...
Debug.WriteLine(email2.Subject);
Debug.WriteLine(email2.From);
Debug.WriteLine(email2.GetHeaderField("X-SOMETHING"));
}
|