Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Excel) Convert Embedded HTML Images to Multipart/Related CID ReferencesDemonstrates how to convert HTML images that are inline/embedded within the HTML to CID references to multipart/related MIME parts. Note: This example requires Chilkat v9.5.0.78 or greater.
' This example assumes the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. ' This example converts the following email with image data embedded directly in the HTML, ' to the MIME shown at the bottom of this page. ' If the HTML contains multiple embedded images, the call to email.ConvertInlineImages will convert all of them. ' MIME-Version: 1.0 ' Date: Tue, 30 Apr 2019 11:36:34 +0200 ' Message-ID: <E5DB5F8A65D671FB4822B22F5309411838F2FC93@PC0VDL0W013> ' Content-Type: text/html; charset="windows-1252" ' Content-Transfer-Encoding: quoted-printable ' X-Priority: 3 (Normal) ' From: <admin@chilkatsoft.com> ' To: Matt <matt@chilkat.io> ' Subject: Test ' ' <html xmlns=3D"http://www.w3.org/1999/xhtml"> ' <body><p> ' <img src=3D"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEA3ADcAAD/2= ' wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoK= ' BggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo= ' ... ' 4zzS3ww+5/8AyR//2Q=3D=3D" width=3D"58" height=3D"66" alt=3D"" style=3D"bord= ' er-width:0px;" /></body> ' </html> Dim email As Chilkat.Email Set email = Chilkat.NewEmail success = email.LoadEml("qa_data/eml/embedded_html_image.eml") success = email.ConvertInlineImages() Debug.Print email.GetMime() ' The MIME after moving the image data to a separate MIME sub-part: ' MIME-Version: 1.0 ' Date: Tue, 30 Apr 2019 11:36:34 +0200 ' Message-ID: <E5DB5F8A65D671FB4822B22F5309411838F2FC93@PC0VDL0W013> ' Content-Type: multipart/related; boundary="------------020808080005060904000806" ' X-Priority: 3 (Normal) ' From: <admin@chilkatsoft.com> ' To: Matt <matt@chilkat.io> ' Subject: Test ' ' --------------020808080005060904000806 ' Content-Type: text/html; charset=windows-1252 ' Content-Transfer-Encoding: quoted-printable ' ' <html xmlns=3D"http://www.w3.org/1999/xhtml"> ' </head></head><body><p> ' <img src=3D"cid:CID-1f73052c-32a7-4abb-8e9d-0afb58c17eed@CHILKATSLICE" widt= ' h=3D"58" height=3D"66" alt=3D"" style=3D"border-width:0px;" /></body> ' </html> ' ' ' ' --------------020808080005060904000806 ' Content-Type: image/jpeg; name="image_95EA3073134C.jpeg" ' Content-Transfer-Encoding: base64 ' Content-ID: <CID-1f73052c-32a7-4abb-8e9d-0afb58c17eed@CHILKATSLICE> ' ' /9j/4AAQSkZJRgABAQEA3ADcAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYF ' BgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoK ' ... ' 5bmGF7e42pOwUxrFNEQOcLGw6vX2Yv7NfxbWLYfB67s84vrf/wCLoor8r424ZwGYZkqlSUk+VLRr ' /Jn2mS8QYzC0Woxi9eqf+aGr+zX8XUyW8K9/+f8Ag/8AjlO/4Zs+Ln/Qqf8Ak/b/APxyiivkXwPl ' H88/vj/8ifUR4zzS3ww+5/8AyR//2Q== ' ' --------------020808080005060904000806-- |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.