(Lianja) 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.
llSuccess = .F.
loEmail = createobject("CkEmail")
// Load an email from a .eml
llSuccess = loEmail.LoadEml("embeddedEmail.eml")
if (llSuccess = .F.) then
? loEmail.LastErrorText
release loEmail
return
endif
// Display how many attached emails are embedded within
// this one:
lnNumAttached = loEmail.NumAttachedMessages
? "numAttached = " + str(lnNumAttached)
// Get the 1st attached message.
loEmail2 = createobject("CkEmail")
llSuccess = loEmail.GetAttachedEmail(0,loEmail2)
if (llSuccess = .T.) then
// Display the subject, From, and a header field...
? loEmail2.Subject
? loEmail2.From
? loEmail2.GetHeaderField("X-SOMETHING")
endif
release loEmail
release loEmail2
|