Tcl
Tcl
Serialize MIME to a String
See more MIME Examples
Demonstrates the Chilkat Mime.GetMime method, which serializes and returns the complete MIME entity — headers, body, multipart boundaries, and all descendants — as a string. It takes no arguments.
Background: This produces the finished MIME text ready to send, store, or hand to another component — the inverse of loading. The whole tree is emitted, including generated multipart boundaries. Because it returns a string, it is best for text-safe content; when the body may contain raw binary bytes, serialize with
GetMimeBd to a BinData instead so nothing is altered.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# Demonstrates the Mime.GetMime method, which serializes and returns the complete MIME entity
# (headers, body, multipart boundaries, and all descendants) as a string. It takes no
# arguments.
set mime [new_CkMime]
# Build a simple MIME entity.
set success [CkMime_SetBodyFromPlainText $mime "Hello, this is the message body."]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
exit
}
# Serialize it to a string.
set mimeText [CkMime_getMime $mime]
if {[CkMime_get_LastMethodSuccess $mime] == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
exit
}
puts "$mimeText"
delete_CkMime $mime