Sample code for 30+ languages & platforms
AutoIt

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 AutoIt Downloads

AutoIt
Local $bSuccess = False

$oEmail = ObjCreate("Chilkat.Email")

$bSuccess = $oEmail.LoadEml("qa_data/eml/happyHour.eml")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

; Is this an HTML email?
If ($oEmail.HasHtmlBody() = True) Then

    ; Unpack the HTML to files.  The image and css URLs
    ; in the HTML are modified to point to the files extracted to disk.
Local $sUnpackDir = "qa_output/emails"
Local $sPartsSubdir = "images"
Local $sHtmlFilename = "happyHour.html"
    $bSuccess = $oEmail.UnpackHtml($sUnpackDir,$sHtmlFilename,$sPartsSubdir)
    If ($bSuccess <> True) Then
        ConsoleWrite($oEmail.LastErrorText & @CRLF)
        Exit
    EndIf

    ConsoleWrite("Success." & @CRLF)
EndIf