(Go) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
success := false
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
mime := Mime_Ref.html">chilkat.NewMime()
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
if success == false {
fmt.Println(mime.LastErrorText())
mime.DisposeMime()
return
}
st := StringTable_Ref.html">chilkat.NewStringTable()
success = mime.PartsToFiles("/temp/mimeParts",st)
if success == false {
fmt.Println(mime.LastErrorText())
mime.DisposeMime()
st.DisposeStringTable()
return
}
n := st.Count()
// Display the paths of the files created:
i := 0
for i < n {
fmt.Println(*st.StringAt(i))
i = i + 1
}
mime.DisposeMime()
st.DisposeStringTable()
|