Lua Requires Chilkat v11.0.0+
Lua
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local mime = chilkat.Mime.new()
-- Load a MIME document from a file:
-- (.mht and .eml files contain MIME).
local success = mime:load_mime_file("mst.mht")
if not success then
print(mime.last_error_text)
return
end
local st = chilkat.StringTable.new()
success = mime:parts_to_files("/temp/mimeParts", st)
if not success then
print(mime.last_error_text)
return
end
local n = st.count
-- Display the paths of the files created:
local i = 0
while i < n do
print(st:string_at(i))
i = i + 1
end