Sample code for 30+ languages & platforms
B4X Requires Chilkat v11.0.0+

Extract Files from MIME

See more MIME Examples

Extract files from a MIME message.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

Dim mime As ChilkatMime
mime.Initialize

'  Load a MIME document from a file:
'  (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
If success = False Then
    Log(mime.LastErrorText)
    Return
End If


Dim st As ChilkatStringTable
st.Initialize
success = mime.PartsToFiles("/temp/mimeParts", st)
If success = False Then
    Log(mime.LastErrorText)
    Return
End If


Dim n As Int = st.Count

'  Display the paths of the files created:
Dim i As Int = 0
Do While i < n
    Log(st.StringAt(i))
    i = i + 1
Loop