CkPython
CkPython
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat CkPython Downloads
import sys
import chilkat
success = False
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
mime = chilkat.CkMime()
# Load a MIME document from a file:
# (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
if (success == False):
print(mime.lastErrorText())
sys.exit()
st = chilkat.CkStringTable()
success = mime.PartsToFiles("/temp/mimeParts",st)
if (success == False):
print(mime.lastErrorText())
sys.exit()
n = st.get_Count()
# Display the paths of the files created:
i = 0
while i < n :
print(st.stringAt(i))
i = i + 1