(VB.NET) 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.
Dim email As New Chilkat.Email
' Load an email object containing HTML with embedded images.
Dim success As Boolean = email.LoadEml("myEmails/HtmlEmail.eml")
If (success <> True) Then
Debug.WriteLine(email.LastErrorText)
Exit Sub
End If
' Iterate over the related items.
' Print the file name and save each to a file.
Dim i As Integer = 0
Dim numRelated As Integer = email.NumRelatedItems
While i < numRelated
Debug.WriteLine(email.GetRelatedFilename(i))
success = email.SaveRelatedItem(i,"myRelatedItemsDir")
If (success <> True) Then
Debug.WriteLine(email.LastErrorText)
Exit Sub
End If
i = i + 1
End While
|