![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
Convert Email HTML to Plain-Text AlternativeLoads an HTML email from a web page, converts the HTML to a plain-text alternative body, and sends it.
<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.