Lianja
Lianja
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 Lianja Downloads
llSuccess = .F.
loMime = createobject("CkMime")
// Create a multipart/mixed entity.
llSuccess = loMime.NewMultipartMixed()
if (llSuccess = .F.) then
? loMime.LastErrorText
release loMime
return
endif
// Boundary is the raw boundary token, without surrounding quotation marks. Chilkat quotes it
// automatically in the serialized header when required.
loMime.Boundary = "example-boundary"
// UseMmDescription controls whether the conventional preamble text
// "This is a multi-part message in MIME format." is emitted. The default is .F..
loMime.UseMmDescription = .T.
// Add a simple part so the multipart has content.
loPart = createobject("CkMime")
llSuccess = loPart.SetBodyFromPlainText("First part.")
if (llSuccess = .F.) then
? loPart.LastErrorText
release loMime
release loPart
return
endif
llSuccess = loMime.AppendPart(loPart)
if (llSuccess = .F.) then
? loMime.LastErrorText
release loMime
release loPart
return
endif
? "Boundary = " + loMime.Boundary
lcMimeStr = loMime.GetMime()
if (loMime.LastMethodSuccess = .F.) then
? loMime.LastErrorText
release loMime
release loPart
return
endif
? lcMimeStr
release loMime
release loPart