(Visual Basic 6.0) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
Dim email As New ChilkatEmail
' Load an email from a .eml
Dim success As Long
success = email.LoadEml("embeddedEmail.eml")
If (success <> 1) Then
Debug.Print email.LastErrorText
Exit Sub
End If
' Display how many attached emails are embedded within
' this one:
Dim numAttached As Long
numAttached = email.NumAttachedMessages
Debug.Print "numAttached = " & numAttached
' Get the 1st attached message.
Dim email2 As ChilkatEmail
Set email2 = email.GetAttachedMessage(0)
If (email.LastMethodSuccess = 1) Then
' Display the subject, From, and a header field...
Debug.Print email2.Subject
Debug.Print email2.From
Debug.Print email2.GetHeaderField("X-SOMETHING")
End If
|