繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> 邮件相关 >> 用HTML格式发送邮件

用HTML格式发送邮件

2006-08-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:  你可以通过SMTP服务或者MS Exchange发送HTML格式的邮件,但是,你需要注意的是,并不是所有的clients都可以正常显示。在通常的情况下,CDONTS发送邮件是使用plain-text格式。在使用HTML方式的时候我们可以进...
关键字:邮件 格式 HTML

  你可以通过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 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 = HTML & "Send Mail with HTML"

HTML = HTML & ""

HTML = HTML & ""

HTML = HTML & ""

HTML = HTML & "

"

HTML = HTML & "

"

HTML = HTML & now() & " - "

HTML = HTML & "These are all great ASP Sites

"

HTML = HTML & ""

HTML = HTML & "

"

HTML = HTML & ""

HTML = HTML & "

"

HTML = HTML & "



"

HTML = 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

%>

责任编辑:admin
相关文章