(AutoIt) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
$oEmail = ObjCreate("Chilkat.Email")
; Load an email from a .eml
Local $bSuccess = $oEmail.LoadEml("embeddedEmail.eml")
If ($bSuccess <> True) 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.
Local $oEmail2
$oEmail2 = $oEmail.GetAttachedMessage(0)
If ($oEmail.LastMethodSuccess = 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
|