DataFlex
DataFlex
Load MIME from a StringBuilder
See more MIME Examples
Demonstrates the Chilkat Mime.LoadMimeSb method, which parses complete MIME text from a StringBuilder and replaces the current MIME. The only argument is the StringBuilder.
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: When the MIME text already lives in a
StringBuilder — assembled in memory, or read and lightly edited — this loads it directly without an intermediate string copy. Its parsing behavior matches LoadMime; the difference is purely the source. For content that might include arbitrary binary bytes, use the BinData loader instead.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Variant vSb
Handle hoSb
Handle hoMime
String sTemp1
Move False To iSuccess
// Demonstrates the Mime.LoadMimeSb method, which parses complete MIME text from a StringBuilder
// and replaces the current MIME. The only argument is the StringBuilder.
// Put the MIME text into a StringBuilder (here loaded from a file, but it could come from
// anywhere).
Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
If (Not(IsComObjectCreated(hoSb))) Begin
Send CreateComObject of hoSb
End
Get ComLoadFile Of hoSb "qa_data/message.eml" "utf-8" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoSb 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 hoSb to vSb
Get ComLoadMimeSb Of hoMime vSb 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