你可以通过smtp服务或者ms exchange发送html格式的邮件,但是,你需要注意的是,并不是所有的clients都可以正常显示。在通常的情况下,cdonts发送邮件是使用plain-text格式。在使用html方式的时候我们可以进行更多的设置,例如不同的字体,颜色,插入图片等等。下面是一个例子
<%
dim objmail
set objmail = server.createobject("cdonts.newmail")
//these are all the images that are in this message.
//you must include them like this.
//please note that you do not have to write the
//entire file path in the <img> tag in the body after this.
//make sure you see the image name after the path separated by a comma
objmail.attachurl "d:\images\myimage.gif", "myimage.gif"
objmail.attachurl "d:\images\myimage2.gif", "myimage2.gif"
html = html & "<html>"
html = html & "<head>"
html = html & "<title>send mail with html</title>"
html = html & "</head>"
html = html & "<body bgcolor=""lightyellow"">"
html = html & "<table cellpadding=""4"">"
html = html & "<tr><th><font color=""darkblue"" size=""4"">"
html = html & now() & " – "
html = html & "these are all great asp sites</font></th></tr>"
html = html & "<tr><td>"
html = html & "<a href=""http://www.4guysfromrolla.com"">"
html = html & "<img src=""myimage.gif""></a><br><br>"
html = html & "<a href=""http://www.4guysfromrolla.com"">"
html = html & "<img src=""myimage2.gif""></a><br><br>"
html = html & "</font></td></tr></table><br><br>"
html = html & "</body>"
html = html & "</html>"
objmail.from = "rob@tconsult.com"
objmail.subject = "your daily html mail"
you need to add these lines for the mail
to be sent in html format
objmail.bodyformat = 0
objmail.mailformat = 0
objmail.to = "you@yourhouse.com
objmail.body = html
objmail.send
response.write("mail was sent")
set objmail = nothing
%>
