Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB Examples

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

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


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Convert Email HTML to Plain-Text Alternative

Loads an HTML email from a web page, converts the HTML to a plain-text alternative body, and sends it.

Download Chilkat Email ActiveX

Download Chilkat HTML-to-XML ActiveX (also includes HTML-to-PlainText conversion)

Download Chilkat MHT ActiveX

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New ChilkatMailMan2

'  The MHT component can be used to convert an HTML page
'  from a URL, file, or in-memory HTML into an email
'  with embedded images and style sheets.
Dim mht As New ChilkatMht

'  Any string argument automatically begins the 30-day trial.
Dim success As Long
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    MsgBox "MailMan component unlock failed"
    Exit Sub
End If

success = mht.UnlockComponent("30-day trial")
If (success <> 1) Then
    MsgBox "Mht component unlock failed"
    Exit Sub
End If

Dim email As ChilkatEmail2

mht.UseCids = 1
Set email = mht.GetEmail("http://www.bonairefishing.com/")
If (email Is Nothing ) Then
    MsgBox mht.LastErrorText
    Exit Sub
End If

email.Subject = "Test HTML/plain-text email"

email.AddTo "Chilkat Support","support@chilkatsoft.com"
email.From = "admin@chilkatsoft.com"

Dim h2t As New HtmlToText
success = h2t.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    MsgBox h2t.LastErrorText
    Exit Sub
End If

'  Get the email's HTML body.
Dim html As String
html = email.GetHtmlBody()

'  Convert it to plain text:
Dim plainText As String
plainText = h2t.ToText(html)

'  Add a plain-text alternative to the email:
email.AddPlainTextAlternativeBody plainText

mailman.SmtpHost = "mail.chilkatsoft.com"
mailman.SmtpUsername = "admin@chilkatsoft.com"
mailman.SmtpPassword = "*myPassword5*"

success = mailman.SendEmail(email)
If (success <> 1) Then
    MsgBox mailman.LastErrorText
    Exit Sub
End If

MsgBox "HTML/plain-text Email Sent!"


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