Visual FoxPro
Visual FoxPro
Unpack HTML Email to Files
Unpacks an HTML email into an HTML file and related files (images and style sheets). The links within the HTML are updated to point to the files unpacked and saved to disk.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loEmail
LOCAL lcUnpackDir
LOCAL lcPartsSubdir
LOCAL lcHtmlFilename
lnSuccess = 0
loEmail = CreateObject('Chilkat.Email')
lnSuccess = loEmail.LoadEml("qa_data/eml/happyHour.eml")
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
* Is this an HTML email?
IF (loEmail.HasHtmlBody() = 1) THEN
* Unpack the HTML to files. The image and css URLs
* in the HTML are modified to point to the files extracted to disk.
lcUnpackDir = "qa_output/emails"
lcPartsSubdir = "images"
lcHtmlFilename = "happyHour.html"
lnSuccess = loEmail.UnpackHtml(lcUnpackDir,lcHtmlFilename,lcPartsSubdir)
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
? "Success."
ENDIF
RELEASE loEmail