Visual FoxPro
Visual FoxPro
Parsing a Multipart/Digest Email
See more Email Object Examples
This example demonstrates how to parse a multipart/digest email. An email parsed by this sample could have a MIME structure as follows:
multipart/mixed
text/plain
text/plain
multipart/digest
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
message/rfc822
text/plain
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL lcEmlPath
LOCAL loEmail
LOCAL lnNumDigests
LOCAL loEDigest
LOCAL i
LOCAL m
lnSuccess = 0
lcEmlPath = "qa_data/eml/multipart_digest.eml"
loEmail = CreateObject('Chilkat.Email')
* For this example, we'll load the email from a .eml.
* The email could alternatively be loaded as a result of downloading from an IMAP or POP3 server..
lnSuccess = loEmail.LoadEml(lcEmlPath)
IF (lnSuccess = 0) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
lnNumDigests = loEmail.NumDigests
? "num digests = " + STR(lnNumDigests)
loEDigest = CreateObject('Chilkat.Email')
i = 0
DO WHILE i < lnNumDigests
loEmail.GetDigestEmail(i,loEDigest)
? STR(i) + ":" + loEDigest.FromAddress + ", " + loEDigest.Subject
m = loEDigest.GetHeaderField("Message")
IF (loEDigest.LastMethodSuccess = 1) THEN
? " Message = " + m
ENDIF
i = i + 1
ENDDO
RELEASE loEmail
RELEASE loEDigest