(Visual FoxPro) Iterate Email Headers
Demonstrates how to iterate over the email header fields.
LOCAL loEmail
LOCAL lnSuccess
LOCAL n
LOCAL i
LOCAL lcName
LOCAL lcValue
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Email')
loEmail = CreateObject('Chilkat.Email')
* First, load an email from a file.
* Note: an email object may be loaded from a file, or
* downloaded directly from a POP3 or IMAP server...
lnSuccess = loEmail.LoadEml("testReceivedHdrs.eml")
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
* How many header fields?
n = loEmail.NumHeaderFields
IF (n > 0) THEN
* Display the name and value of each header:
FOR i = 0 TO n - 1
lcName = loEmail.GetHeaderFieldName(i)
lcValue = loEmail.GetHeaderFieldValue(i)
? STR(i)
? lcName
? lcValue
NEXT
ENDIF
RELEASE loEmail
|