VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

Convert HTML String to MHT

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

Demonstrates how to convert an in-memory HTML string to a .mht file. The HTML includes an image that is loaded from the local filesystem.

        Dim mht As New Chilkat.Mht()
        mht.UnlockComponent("anything for 30-day trial")

        ' Convert HTML to MHT.  All referenced images are embedded in the MIME string
        ' returned.  Referenced images (or other items referenced from within the HTML)
        ' should be:
        ' (1) A URL
        ' (2) A file on the local system with an absolute pathname.
        ' (3) A file on the local system with a relative pathname that correctly resolves
        '     from the calling process' current working directory.
        Dim mhtStr As String
        mhtStr = mht.HtmlToMHT("<html><head><META http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-7""></head><body>This is a test<br /><img src=""images/dude.gif"" /></body></html>")

        ' IMPORTANT: You do not want to write the .mht file in this way.  By doing so, the
        ' StreamWriter class writes the utf-8 preamble to the file.  When you try to open the .mht
        ' in Internet Explorer, it will load as a text file displaying the MIME source.
        Dim appendMode As Boolean = False ' This overwrites the entire file.
        Dim sw As New System.IO.StreamWriter("outBad.mht", appendMode, System.Text.Encoding.UTF8)
        sw.Write(mhtStr)
        sw.Close()

        ' Use this code to write the .mht instead.
        Dim sw2 As New System.IO.StreamWriter("outGood.mht", appendMode, System.Text.Encoding.ASCII)
        sw2.Write(mhtStr)
        sw2.Close()




 

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser