Sample code for 30+ languages & platforms
Visual FoxPro 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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loEmail
LOCAL loName
LOCAL lnHops
LOCAL i

lnSuccess = 0

*  Assumes Chilkat is unlocked. See Global Unlock Sample.

loEmail = CreateObject('Chilkat.Email')
lnSuccess = loEmail.LoadEml("received.eml")
IF (lnSuccess <> 1) THEN
    ? loEmail.LastErrorText
    RELEASE loEmail
    CANCEL
ENDIF

loName = CreateObject('Chilkat.StringBuilder')
lnHops = 0
i = 0
DO WHILE (i < loEmail.NumHeaderFields)
    loName.SetString(loEmail.GetHeaderFieldName(i))
    IF (loName.ContentsEqual("Received",0) = 1) THEN
        lnHops = lnHops + 1
        ? "Hop " + STR(lnHops) + ": " + loEmail.GetHeaderFieldValue(i)
    ENDIF

    i = i + 1
ENDDO
? "Received fields: " + STR(lnHops)

RELEASE loEmail
RELEASE loName