(Tcl) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set success 0
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set mime [new_CkMime]
# Load a MIME document from a file:
# (.mht and .eml files contain MIME).
set success [CkMime_LoadMimeFile $mime "mst.mht"]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
exit
}
set st [new_CkStringTable]
set success [CkMime_PartsToFiles $mime "/temp/mimeParts" $st]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
delete_CkStringTable $st
exit
}
set n [CkStringTable_get_Count $st]
# Display the paths of the files created:
set i 0
while {$i < $n} {
puts [CkStringTable_stringAt $st $i]
set i [expr $i + 1]
}
delete_CkMime $mime
delete_CkStringTable $st
|