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

Trace the Received headers on a delivered message

See more Email Object Examples

Each relay prepends its Received field. Read the trace from top to bottom for newest to oldest, and interpret fields in light of the relays you trust. An unsent local draft can have no trace headers.

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("received.eml")
If success <> True Then
    Log(email.LastErrorText)
    Return
End If

Dim name As ChilkatStringBuilder
name.Initialize
Dim hops As Int = 0
Dim i As Int = 0
Do While (i < email.NumHeaderFields)
    name.SetString(email.GetHeaderFieldName(i))
    If name.ContentsEqual("Received", False) = True Then
        hops = hops + 1
        Log("Hop " & hops & ": " & email.GetHeaderFieldValue(i))
    End If

    i = i + 1
Loop
Log("Received fields: " & hops)