Sample code for 30+ languages & platforms
Tcl Requires Chilkat v11.0.0+

Read messages attached to another email

See more Email Object Examples

Load the wrapper from the preceding example and read the author and subject of each message/rfc822 part. Ordinary files are counted separately by NumAttachments.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

#  Assumes Chilkat is unlocked. See Global Unlock Sample.

set email [new_CkEmail]

set success [CkEmail_LoadEml $email "correspondence.eml"]
if {$success != 1} then {
    puts [CkEmail_lastErrorText $email]
    delete_CkEmail $email
    exit
}

puts "Attached messages: [CkEmail_get_NumAttachedMessages $email]"
set nested [new_CkEmail]

set i 0
while {$i < [CkEmail_get_NumAttachedMessages $email]} {
    set success [CkEmail_GetAttachedEmail $email $i $nested]
    if {$success != 1} then {
        puts [CkEmail_lastErrorText $email]
        delete_CkEmail $email
        delete_CkEmail $nested
        exit
    }

    puts [CkEmail_from $nested]  [CkEmail_subject $nested]
    set i [expr $i + 1]
}

delete_CkEmail $email
delete_CkEmail $nested