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

Export HTML and related files into a directory

See more Email Object Examples

Choose a separate directory for each message. UnpackHtml writes the HTML file, exports its related resources, and rewrites links to their local paths. This is useful when images should remain separate files.

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 "inline-image.eml"]
if {$success != 1} then {
    puts [CkEmail_lastErrorText $email]
    delete_CkEmail $email
    exit
}

if {[CkEmail_HasHtmlBody $email] != 1} then {
    puts "This message has no HTML body."
    delete_CkEmail $email
    exit
}

set success [CkEmail_UnpackHtml $email "workshop-preview" "index.html" "images"]
if {$success != 1} then {
    puts [CkEmail_lastErrorText $email]
    delete_CkEmail $email
    exit
}

puts "Saved workshop-preview/index.html and its related files."

delete_CkEmail $email