PureBasic
PureBasic
Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).Chilkat PureBasic Downloads
IncludeFile "CkEmail.pb"
Procedure ChilkatExample()
success.i = 0
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Load an email from a .eml
success = CkEmail::ckLoadEml(email,"embeddedEmail.eml")
If success = 0
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 = CkEmail::ckCreate()
If email2.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkEmail::ckGetAttachedEmail(email,0,email2)
If success = 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)
CkEmail::ckDispose(email2)
ProcedureReturn
EndProcedure