VBScript Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VBScript Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
Byte Array
RSS
Atom

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

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.
set mailman = CreateObject("Chilkat.MailMan2")

'  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.
set mht = CreateObject("Chilkat.Mht")

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

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

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

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

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

set h2t = CreateObject("Chilkat.HtmlToText")
success = h2t.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    MsgBox h2t.LastErrorText
    WScript.Quit
End If

'  Get the email's HTML body.

html = email.GetHtmlBody()

'  Convert it to plain text:

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
    WScript.Quit
End If

MsgBox "HTML/plain-text Email Sent!"


Need a specific example? Send a request to support@chilkatsoft.com

© 2003-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser