DataFlex
DataFlex
Load MIME from BinData
See more MIME Examples
Demonstrates the Chilkat Mime.LoadMimeBd method, which parses complete MIME bytes from a BinData and replaces the current MIME. The only argument is the BinData.
Note: The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.
Background: This is the safest loader because it works on raw bytes: MIME can carry 8-bit content and even embedded NUL bytes that a text string would mangle, so loading from a
BinData preserves the message exactly. Prefer it whenever the input is binary or of uncertain encoding — a downloaded message, a file read as bytes — over the string-based loaders.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Variant vBd
Handle hoBd
Handle hoMime
String sTemp1
Move False To iSuccess
// Demonstrates the Mime.LoadMimeBd method, which parses complete MIME bytes from a BinData and
// replaces the current MIME. The only argument is the BinData. This is the preferred loader
// when the MIME may contain arbitrary 8-bit or embedded NUL bytes.
Get Create (RefClass(cComChilkatBinData)) To hoBd
If (Not(IsComObjectCreated(hoBd))) Begin
Send CreateComObject of hoBd
End
Get ComLoadFile Of hoBd "qa_data/message.eml" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoBd To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
Get pvComObject of hoBd to vBd
Get ComLoadMimeBd Of hoMime vBd To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComContentType Of hoMime To sTemp1
Showln "Content-Type: " sTemp1
End_Procedure