Sample code for 30+ languages & platforms
Xojo Plugin Requires Chilkat v11.0.0+

Access Attached Message (Embedded Email)

How to access an email embedded within another email (i.e. an attached message).

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

Dim email As New Chilkat.Email

//  Load an email from a .eml
success = email.LoadEml("embeddedEmail.eml")
If (success = False) Then
    System.DebugLog(email.LastErrorText)
    Return
End If

//  Display how many attached emails are embedded within
//  this one:
Dim numAttached As Int32
numAttached = email.NumAttachedMessages
System.DebugLog("numAttached = " + Str(numAttached))

//  Get the 1st attached message.
Dim email2 As New Chilkat.Email
success = email.GetAttachedEmail(0,email2)
If (success = True) Then

    //  Display the subject, From, and a header field...
    System.DebugLog(email2.Subject)
    System.DebugLog(email2.From)
    System.DebugLog(email2.GetHeaderField("X-SOMETHING"))
End If