Tcl
Tcl
MIME Multipart Boundary and Preamble Properties
See more MIME Examples
Demonstrates the Boundary property, which gets or sets the raw boundary token of a multipart entity (without surrounding quotation marks), and UseMmDescription, which controls whether the conventional preamble text is emitted when serializing a multipart entity.
Background. A multipart boundary separates the constituent parts. Chilkat quotes the token automatically in the header when required. The preamble is ignored by MIME-aware readers and is off by default.
Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
set mime [new_CkMime]
# Create a multipart/mixed entity.
set success [CkMime_NewMultipartMixed $mime]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
exit
}
# Boundary is the raw boundary token, without surrounding quotation marks. Chilkat quotes it
# automatically in the serialized header when required.
CkMime_put_Boundary $mime "example-boundary"
# UseMmDescription controls whether the conventional preamble text
# "This is a multi-part message in MIME format." is emitted. The default is 0.
CkMime_put_UseMmDescription $mime 1
# Add a simple part so the multipart has content.
set part [new_CkMime]
set success [CkMime_SetBodyFromPlainText $part "First part."]
if {$success == 0} then {
puts [CkMime_lastErrorText $part]
delete_CkMime $mime
delete_CkMime $part
exit
}
set success [CkMime_AppendPart $mime $part]
if {$success == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
delete_CkMime $part
exit
}
puts "Boundary = [CkMime_boundary $mime]"
set mimeStr [CkMime_getMime $mime]
if {[CkMime_get_LastMethodSuccess $mime] == 0} then {
puts [CkMime_lastErrorText $mime]
delete_CkMime $mime
delete_CkMime $part
exit
}
puts "$mimeStr"
delete_CkMime $mime
delete_CkMime $part