VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

Visual FoxPro Examples

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

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

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

 

Non-Chilkat Links
Text and String Handling

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

LOCAL loMailman
LOCAL loMht
LOCAL lnSuccess
LOCAL loEmail
LOCAL loH2t
LOCAL lcHtml
LOCAL lcPlainText

*  The mailman object is used for receiving (POP3)
*  and sending (SMTP) email.
loMailman = 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.
loMht = CreateObject('Chilkat.Mht')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loMailman.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("MailMan component unlock failed")
    QUIT
ENDIF

lnSuccess = loMht.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Mht component unlock failed")
    QUIT
ENDIF

loMht.UseCids = 1
loEmail = loMht.GetEmail("http://www.bonairefishing.com/")
IF (loEmail = NULL ) THEN
    =MESSAGEBOX(loMht.LastErrorText)
    QUIT
ENDIF

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

loEmail.AddTo("Chilkat Support","support@chilkatsoft.com")
loEmail.From = "admin@chilkatsoft.com"

loH2t = CreateObject('Chilkat.HtmlToText')
lnSuccess = loH2t.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loH2t.LastErrorText)
    QUIT
ENDIF

*  Get the email's HTML body.

lcHtml = loEmail.GetHtmlBody()

*  Convert it to plain text:

lcPlainText = loH2t.ToText(lcHtml)

*  Add a plain-text alternative to the email:
loEmail.AddPlainTextAlternativeBody(lcPlainText)

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

lnSuccess = loMailman.SendEmail(loEmail)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loMailman.LastErrorText)
    QUIT
ENDIF

RELEASE loEmail

=MESSAGEBOX("HTML/plain-text Email Sent!")


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

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

Mail Component · .NET Email Component · ASP Mail Component · XML Parser