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

Export HTML and related files into a directory

See more Email Object Examples

Choose a separate directory for each message. UnpackHtml writes the HTML file, exports its related resources, and rewrites links to their local paths. This is useful when images should remain separate files.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

#  Assumes Chilkat is unlocked. See Global Unlock Sample.

$email = New-Object Chilkat.Email
$success = $email.LoadEml("inline-image.eml")
if ($success -ne $true) {
    $($email.LastErrorText)
    exit
}

if ($email.HasHtmlBody() -ne $true) {
    $("This message has no HTML body.")
    exit
}

$success = $email.UnpackHtml("workshop-preview","index.html","images")
if ($success -ne $true) {
    $($email.LastErrorText)
    exit
}

$("Saved workshop-preview/index.html and its related files.")