Sending Email in HTML format using
CDONTS.NewMail Object
This Sample code will help you understand how you can send a HTML formated email
from an ASP page using the CDONTS.NewMail object.
<% Option Explicit
Dim objMail Dim strSubject Dim strBody
strSubject = "This is a test email in HTML format"
strBody = "<HTML>" & _
"<HEAD></HEAD>" & _
"<BODY>" & _
" <Font Face=Arial Size=5><B>"
& _
" This is a test Email" &
_
" </B></Font><BR>"
& _
" <H3><A Href=http://www.devasp.com>Click
here</a>" & _
" to go to DevASP.com</h3>" &
_
"</BODY>" & _
"</HTML>"
' First create an instance of the
NewMail Object Set objMail = Server.CreateObject("CDONTS.NewMail")
' Please replace the "From"
and "To" email addresses with your
' own valid email address. I recieve
too many emails
' from people who test this sample
and keep sending
' emails to test@devasp.com, or
they keep the "From" property
' as webmaster@devasp.com and I
get response of
' undeliverable emails.
' NOTE: If the "To" or
"From" properties of CDONTS contain
' invalid email address you will
not recieve the email.