Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Classic ASP Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

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.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
set mailman = Server.CreateObject("Chilkat_9_5_0.MailMan")

'  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 = Server.CreateObject("Chilkat_9_5_0.Mht")

'  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "MailMan component unlock failed" & "<br>"

End If

success = mht.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "Mht component unlock failed" & "<br>"

End If

mht.UseCids = 1
Set email = mht.GetEmail("http://www.bonairefishing.com/")
If (email Is Nothing ) Then
    Response.Write mht.LastErrorText & "<br>"

End If

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

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

set h2t = Server.CreateObject("Chilkat_9_5_0.HtmlToText")
success = h2t.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    Response.Write h2t.LastErrorText & "<br>"

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
    Response.Write mailman.LastErrorText & "<br>"

End If

Response.Write "HTML/plain-text Email Sent!" & "<br>"


%>
</body>
</html>

 

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