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