Sample code for 30+ languages & platforms
Classic ASP

Unpack HTML Email to Files

Unpacks an HTML email into an HTML file and related files (images and style sheets). The links within the HTML are updated to point to the files unpacked and saved to disk.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set email = Server.CreateObject("Chilkat.Email")

success = email.LoadEml("qa_data/eml/happyHour.eml")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
    Response.End
End If

' Is this an HTML email?
If (email.HasHtmlBody() = 1) Then

    ' Unpack the HTML to files.  The image and css URLs
    ' in the HTML are modified to point to the files extracted to disk.
    unpackDir = "qa_output/emails"
    partsSubdir = "images"
    htmlFilename = "happyHour.html"
    success = email.UnpackHtml(unpackDir,htmlFilename,partsSubdir)
    If (success <> 1) Then
        Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
        Response.End
    End If

    Response.Write "<pre>" & Server.HTMLEncode( "Success.") & "</pre>"
End If


%>
</body>
</html>