Classic ASP Requires Chilkat v11.0.0+
Classic ASP
Create an email with plain-text and HTML bodies
See more Email Object Examples
Set the From and Reply-To addresses, add a recipient, and provide plain-text and HTML versions of the same body. Save the message as text-and-html.eml.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set email = Server.CreateObject("Chilkat.Email")
email.FromName = "Sam Lee"
email.FromAddress = "sam@example.com"
email.ReplyTo = "replies@example.com"
success = email.AddTo("Alex Rivera","alex@example.net")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
email.Subject = "Sample message"
email.Charset = "utf-8"
' A custom header can carry a reference alongside the standard message fields.
email.AddHeaderField "X-Reference-ID","REF-42"
success = email.AddPlainTextAlternativeBody("Read more at https://example.com/details.")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
success = email.AddHtmlAlternativeBody("<p><a href='https://example.com/details'>Read more</a></p>")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
success = email.SaveEml("text-and-html.eml")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Saved text-and-html.eml.") & "</pre>"
%>
</body>
</html>