(VBScript) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set mime = CreateObject("Chilkat.Mime")
' Load a MIME document from a file:
' (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
If (success = 0) Then
outFile.WriteLine(mime.LastErrorText)
WScript.Quit
End If
set st = CreateObject("Chilkat.StringTable")
success = mime.PartsToFiles("/temp/mimeParts",st)
If (success = 0) Then
outFile.WriteLine(mime.LastErrorText)
WScript.Quit
End If
n = st.Count
' Display the paths of the files created:
i = 0
Do While i < n
outFile.WriteLine(st.StringAt(i))
i = i + 1
Loop
outFile.Close
|