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

Inspect the MIME structure and contents of an EML file

See more Email Object Examples

Open the complete EML in Mime for a tree view and in Email for application-level collections. An HTML logo, downloadable file, attached message, and delivery report are counted separately. Try the complex workshop draft.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim email As ChilkatEmail
email.Initialize
success = email.LoadEml("workshop.eml")
If success <> True Then
    Log(email.LastErrorText)
    Return
End If

Dim mime As ChilkatMime
mime.Initialize
success = mime.LoadMimeFile("workshop.eml")
If success <> True Then
    Log(mime.LastErrorText)
    Return
End If

Log(mime.GetStructure("text"))
Log("Subject: " & email.Subject)
Log("Files: " & email.NumAttachments & "  Related items: " & email.NumRelatedItems)
Log("Attached messages: " & email.NumAttachedMessages & "  Reports: " & email.NumReports)
Dim i As Int = 0
Do While (i < email.NumAttachments)
    Log(email.GetAttachmentFilename(i) & "  " & email.GetAttachmentContentType(i) & "  " & email.GetAttachmentSize(i) & " bytes")
    i = i + 1
Loop
i = 0
Do While (i < email.NumRelatedItems)
    Log("Related: " & email.GetRelatedFilename(i) & "  " & email.GetRelatedContentType(i))
    i = i + 1
Loop