DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
Variant vPart
Handle hoPart
String sMimeStr
String sTemp1
Boolean bTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
// Create a multipart/mixed entity.
Get ComNewMultipartMixed Of hoMime To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
// Boundary is the raw boundary token, without surrounding quotation marks. Chilkat quotes it
// automatically in the serialized header when required.
Set ComBoundary Of hoMime To "example-boundary"
// UseMmDescription controls whether the conventional preamble text
// "This is a multi-part message in MIME format." is emitted. The default is False.
Set ComUseMmDescription Of hoMime To True
// Add a simple part so the multipart has content.
Get Create (RefClass(cComChilkatMime)) To hoPart
If (Not(IsComObjectCreated(hoPart))) Begin
Send CreateComObject of hoPart
End
Get ComSetBodyFromPlainText Of hoPart "First part." To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoPart To sTemp1
Showln sTemp1
Procedure_Return
End
Get pvComObject of hoPart to vPart
Get ComAppendPart Of hoMime vPart To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComBoundary Of hoMime To sTemp1
Showln "Boundary = " sTemp1
Get ComGetMime Of hoMime To sMimeStr
Get ComLastMethodSuccess Of hoMime To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Showln sMimeStr
End_Procedure