![]() |
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
ASP Script to Send HTML Email
ASP script showing how to send HTML email. See Also:ASP Plain-Text Email <%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Mail HTML with Embedded Image Example</TITLE>
</HEAD>
<BODY>
<%
' Create a mailman
set mailman = Server.CreateObject("Chilkat_9_5_0.MailMan")
' Any string begins the 30-day trial
success = mailman.UnlockComponent("30-day trial")
if (success = 0) then
Response.write "Unlock Failed!<br>"
end if
' Tell the mailman where the SMTP server is located
mailman.SmtpHost = "mail.earthlink.net"
' Create an Email message
set email = Server.CreateObject("Chilkat_9_5_0.Email")
' Enter the recipient's information
email.AddTo "John Smith", "jsmith@chilkatsoft.com"
' Enter the sender's information
email.FromName = "Joe Smith"
email.FromAddress = "joe.smith@somedomain.com"
' Enter the email subject
email.Subject = "Here is an image in HTML"
' Modify this to point to your GIF image file.
imageContentID = email.AddRelatedFile("c:\temp\dudeMail.gif")
' Enter the email text
email.SetHtmlBody ("<HTML><HEAD></HEAD><BODY>"& _
"<br>This is an example of embedding an image in HTML email.<BR><IMG SRC="& _
chr(34)&"cid:"&imageContentID&chr(34)& _
"><br>The content ID of the image looks like this: "& _
imageContentID&"<br>The HTML for embedding the image looks like this: <img src="& _
chr(34)&"cid:"&imageContentID&chr(34)&"><br></BODY></HTML>")
' Send Email from ASP
if mailman.SendEmail(email) then
Response.write mailman.LastErrorHtml
Response.write "Message sent successfully!<br><br>"
else
Response.write mailman.LastErrorHtml
end if
Set email = Nothing
Set mailman = Nothing
%>
</BODY>
</HTML>
|
|||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.