(Visual FoxPro) 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.
LOCAL lnSuccess
LOCAL loEmail
LOCAL lnNumAttached
LOCAL loEmail2
lnSuccess = 0
loEmail = CreateObject('Chilkat.Email')
* Load an email from a .eml
lnSuccess = loEmail.LoadEml("embeddedEmail.eml")
IF (lnSuccess = 0) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
* Display how many attached emails are embedded within
* this one:
lnNumAttached = loEmail.NumAttachedMessages
? "numAttached = " + STR(lnNumAttached)
* Get the 1st attached message.
loEmail2 = CreateObject('Chilkat.Email')
lnSuccess = loEmail.GetAttachedEmail(0,loEmail2)
IF (lnSuccess = 1) THEN
* Display the subject, From, and a header field...
? loEmail2.Subject
? loEmail2.From
? loEmail2.GetHeaderField("X-SOMETHING")
ENDIF
RELEASE loEmail
RELEASE loEmail2
|