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

Read email headers and display the body as text

See more Email Object Examples

Read the sender, recipients, subject, date, and an optional custom header from an EML file. Display the plain-text body when available, or convert HTML to text. Handle messages that contain neither body format.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  Assumes Chilkat is unlocked. See Global Unlock Sample.

$oEmail = ObjCreate("Chilkat.Email")
$bSuccess = $oEmail.LoadEml("with-attachments.eml")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("From: " & $oEmail.From & @CRLF)
ConsoleWrite("Subject: " & $oEmail.Subject & @CRLF)
ConsoleWrite("Date: " & $oEmail.EmailDateStr & @CRLF)
Local $i = 0
While ($i < $oEmail.NumTo)
    ConsoleWrite("To: " & $oEmail.GetToName($i) & "  " & $oEmail.GetToAddr($i) & @CRLF)
    $i = $i + 1
Wend
Local $sReferenceId = $oEmail.GetHeaderField("X-Reference-ID")
If ($oEmail.LastMethodSuccess = True) Then
    ConsoleWrite("Reference: " & $sReferenceId & @CRLF)
EndIf

If ($oEmail.HasPlainTextBody() = True) Then
    ConsoleWrite($oEmail.GetPlainTextBody() & @CRLF)
Else
    If ($oEmail.HasHtmlBody() = True) Then
        $oReader = ObjCreate("Chilkat.HtmlToText")
        ConsoleWrite($oReader.ToText($oEmail.GetHtmlBody()) & @CRLF)
    Else
        ConsoleWrite("No text or HTML body." & @CRLF)
    EndIf

EndIf