PowerShell
PowerShell
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$mime = New-Object Chilkat.Mime
# Load a MIME document from a file:
# (.mht and .eml files contain MIME).
$success = $mime.LoadMimeFile("mst.mht")
if ($success -eq $false) {
$($mime.LastErrorText)
exit
}
$st = New-Object Chilkat.StringTable
$success = $mime.PartsToFiles("/temp/mimeParts",$st)
if ($success -eq $false) {
$($mime.LastErrorText)
exit
}
$n = $st.Count
# Display the paths of the files created:
$i = 0
while ($i -lt $n) {
$($st.StringAt($i))
$i = $i + 1
}