Tcl
Tcl
Load MIME from BinData
See more MIME Examples
Demonstrates the Chilkat Mime.LoadMimeBd method, which parses complete MIME bytes from a BinData and replaces the current MIME. The only argument is the BinData.
Note: The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.
Background: This is the safest loader because it works on raw bytes: MIME can carry 8-bit content and even embedded NUL bytes that a text string would mangle, so loading from a
BinData preserves the message exactly. Prefer it whenever the input is binary or of uncertain encoding — a downloaded message, a file read as bytes — over the string-based loaders.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# Demonstrates the Mime.LoadMimeBd method, which parses complete MIME bytes from a BinData and
# replaces the current MIME. The only argument is the BinData. This is the preferred loader
# when the MIME may contain arbitrary 8-bit or embedded NUL bytes.
set bd [new_CkBinData]
set success [CkBinData_LoadFile $bd "qa_data/message.eml"]
if {$success == 0} then {
puts [CkBinData_lastErrorText $bd]
delete_CkBinData $bd
exit
}
set mime [new_CkMime]
set success [CkMime_LoadMimeBd $mime $bd]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkBinData $bd
delete_CkMime $mime
exit
}
puts "Content-Type: [CkMime_contentType $mime]"
delete_CkBinData $bd
delete_CkMime $mime