DataFlex
DataFlex
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
Variant vSt
Handle hoSt
Integer n
Integer i
String sTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
Get ComLoadMimeFile Of hoMime "mst.mht" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringTable)) To hoSt
If (Not(IsComObjectCreated(hoSt))) Begin
Send CreateComObject of hoSt
End
Get pvComObject of hoSt to vSt
Get ComPartsToFiles Of hoMime "/temp/mimeParts" vSt To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComCount Of hoSt To n
// Display the paths of the files created:
Move 0 To i
While (i < n)
Get ComStringAt Of hoSt i To sTemp1
Showln sTemp1
Move (i + 1) To i
Loop
End_Procedure