Visual FoxPro
Visual FoxPro
Save HTML Email Embedded Images
Saves HTML embedded items to files in a subdirectory. Images, style sheets, and anything else embedded within HTML, are not considered to be attachments. Instead, these items are "related item". The Chilkat email object provides a set of methods/properties for accessing the related items within an email.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loEmail
LOCAL i
LOCAL lnNumRelated
lnSuccess = 0
loEmail = CreateObject('Chilkat.Email')
* Load an email object containing HTML with embedded images.
lnSuccess = loEmail.LoadEml("myEmails/HtmlEmail.eml")
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
* Iterate over the related items.
* Print the file name and save each to a file.
i = 0
lnNumRelated = loEmail.NumRelatedItems
DO WHILE i < lnNumRelated
? loEmail.GetRelatedFilename(i)
lnSuccess = loEmail.SaveRelatedItem(i,"myRelatedItemsDir")
IF (lnSuccess <> 1) THEN
? loEmail.LastErrorText
RELEASE loEmail
CANCEL
ENDIF
i = i + 1
ENDDO
RELEASE loEmail