Xbase++
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oMime
LOCAL oPart
LOCAL cMimeStr
nSuccess := 0
oMime := CreateObject("Chilkat.Mime")
// Create a multipart/mixed entity.
nSuccess := oMime:NewMultipartMixed()
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
RETURN
ENDIF
// Boundary is the raw boundary token, without surrounding quotation marks. Chilkat quotes it
// automatically in the serialized header when required.
oMime:Boundary := "example-boundary"
// UseMmDescription controls whether the conventional preamble text
// "This is a multi-part message in MIME format." is emitted. The default is 0.
oMime:UseMmDescription := 1
// Add a simple part so the multipart has content.
oPart := CreateObject("Chilkat.Mime")
nSuccess := oPart:SetBodyFromPlainText("First part.")
IF (nSuccess == 0)
? oPart:LastErrorText
oMime:destroy()
oPart:destroy()
RETURN
ENDIF
nSuccess := oMime:AppendPart(oPart)
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
oPart:destroy()
RETURN
ENDIF
? "Boundary = " + oMime:Boundary
cMimeStr := oMime:GetMime()
IF (oMime:LastMethodSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
oPart:destroy()
RETURN
ENDIF
? cMimeStr
oMime:destroy()
oPart:destroy()