(Visual Basic 6.0) 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.
Dim success As Long
success = 0
Dim email As New ChilkatEmail
' Load an email from a .eml
success = email.LoadEml("embeddedEmail.eml")
If (success = 0) 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 New ChilkatEmail
success = email.GetAttachedEmail(0,email2)
If (success = 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
|