(Visual FoxPro) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
LOCAL loEmail
LOCAL lnSuccess
LOCAL lnNumAttached
LOCAL loEmail2
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Email')
loEmail = CreateObject('Chilkat.Email')
* Load an email from a .eml
lnSuccess = loEmail.LoadEml("embeddedEmail.eml")
IF (lnSuccess <> 1) 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 = loEmail.GetAttachedMessage(0)
IF (loEmail.LastMethodSuccess = 1) THEN
* Display the subject, From, and a header field...
? loEmail2.Subject
? loEmail2.From
? loEmail2.GetHeaderField("X-SOMETHING")
ENDIF
RELEASE loEmail
|