Sample code for 30+ languages & platforms
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.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim email As New Chilkat.Email

'  Load an email object containing HTML with embedded images.

success = 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