Sample code for 30+ languages & platforms
VBScript 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 VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

set email = CreateObject("Chilkat.Email")
success = email.LoadEml("inline-image.eml")
If (success <> 1) Then
    outFile.WriteLine(email.LastErrorText)
    WScript.Quit
End If

If (email.HasHtmlBody() <> 1) Then
    outFile.WriteLine("This message has no HTML body.")
    WScript.Quit
End If

success = email.UnpackHtml("workshop-preview","index.html","images")
If (success <> 1) Then
    outFile.WriteLine(email.LastErrorText)
    WScript.Quit
End If

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

outFile.Close