(AutoIt) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message). Note: This example requires Chilkat v11.0.0 or greater.
Local $bSuccess = False
$oEmail = ObjCreate("Chilkat.Email")
; Load an email from a .eml
$bSuccess = $oEmail.LoadEml("embeddedEmail.eml")
If ($bSuccess = False) Then
ConsoleWrite($oEmail.LastErrorText & @CRLF)
Exit
EndIf
; Display how many attached emails are embedded within
; this one:
Local $iNumAttached = $oEmail.NumAttachedMessages
ConsoleWrite("numAttached = " & $iNumAttached & @CRLF)
; Get the 1st attached message.
$oEmail2 = ObjCreate("Chilkat.Email")
$bSuccess = $oEmail.GetAttachedEmail(0,$oEmail2)
If ($bSuccess = True) Then
; Display the subject, From, and a header field...
ConsoleWrite($oEmail2.Subject & @CRLF)
ConsoleWrite($oEmail2.From & @CRLF)
ConsoleWrite($oEmail2.GetHeaderField("X-SOMETHING") & @CRLF)
EndIf
|