(Tcl) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
load ./chilkat.dll
set email [new_CkEmail]
# Load an email from a .eml
set success [CkEmail_LoadEml $email "embeddedEmail.eml"]
if {$success != 1} then {
puts [CkEmail_lastErrorText $email]
delete_CkEmail $email
exit
}
# Display how many attached emails are embedded within
# this one:
set numAttached [CkEmail_get_NumAttachedMessages $email]
puts "numAttached = $numAttached"
# Get the 1st attached message.
# email2 is a CkEmail
set email2 [CkEmail_GetAttachedMessage $email 0]
if {[CkEmail_get_LastMethodSuccess $email] == 1} then {
# Display the subject, From, and a header field...
puts [CkEmail_subject $email2]
puts [CkEmail_from $email2]
puts [CkEmail_getHeaderField $email2 X-SOMETHING]
}
delete_CkEmail $email
|