Visual FoxPro Requires Chilkat v11.0.0+
Visual FoxPro
Read the plain-text and HTML bodies separately
See more Email Object Examples
When both alternatives exist, Body returns HTML. Use the explicit body accessors to choose text for an index or HTML for a viewer. This example reads alternatives.eml from the previous example.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loEmail
lnSuccess = 0
* Assumes Chilkat is unlocked. See Global Unlock Sample.
loEmail = CreateObject('Chilkat.Email')
lnSuccess = loEmail.LoadEml("alternatives.eml")
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
* A message can have either representation, both, or neither.
IF (loEmail.HasPlainTextBody() = 1) THEN
? "Plain text: " + loEmail.GetPlainTextBody()
ENDIF
IF (loEmail.HasHtmlBody() = 1) THEN
? "HTML source: " + loEmail.GetHtmlBody()
ENDIF
IF ((loEmail.HasPlainTextBody() = 0) AND (loEmail.HasHtmlBody() = 0)) THEN
? "No text or HTML body. Inspect the MIME parts."
ENDIF
RELEASE loEmail