(PureBasic) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
IncludeFile "CkEmail.pb"
Procedure ChilkatExample()
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Load an email from a .eml
success.i = CkEmail::ckLoadEml(email,"embeddedEmail.eml")
If success <> 1
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
ProcedureReturn
EndIf
; Display how many attached emails are embedded within
; this one:
numAttached.i = CkEmail::ckNumAttachedMessages(email)
Debug "numAttached = " + Str(numAttached)
; Get the 1st attached message.
email2.i
email2 = CkEmail::ckGetAttachedMessage(email,0)
If CkEmail::ckLastMethodSuccess(email) = 1
; Display the subject, From, and a header field...
Debug CkEmail::ckSubject(email2)
Debug CkEmail::ckFrom(email2)
Debug CkEmail::ckGetHeaderField(email2,"X-SOMETHING")
EndIf
CkEmail::ckDispose(email)
ProcedureReturn
EndProcedure
|