windows虚拟主机CDONTS组件发信方案

windows虚拟主机CDONTS组件发信方案

更新时间:2020-01-07 17:04:37

CDONTS支持如下的方法:
<%Set Mymail = CreateObject("CDONTS.NewMail")
Mymail.From = *** '信件发送者信箱
Mymail.To = *** ‘信件接收者信箱
Mymail.CC = *** '抄送
Mymail.BCC = *** ’密件发送
Mymail.Subject = *** ‘信件主题
Mymail.Body = *** ’信件正文
'设置优先级,0-不重要,1-一般,2-重要。
Mymail.Importance = 2
Mymail.Send
Set Mymail = Nothing%>
注释:***字符串可能是写进去的,也可能是取自表单,使用Request方法。

如何使用CDONTS组件发基于HTML的信件?

<%
Set MyMail2 = CreateObject("CDONTS.NewMail")
HTML = ""
HTML = HTML & ""
HTML = HTML & "
<span style="font-family: 微软雅黑, 'Microsoft YaHei'; font-size: 14px;">Sending CDONTS Email Using HTML</span>"
HTML = HTML & ""
HTML = HTML & ""
HTML = HTML & "

"
HTML = HTML & "This is a test mail in html
"
HTML = HTML & "Mail content here ...

"
HTML = HTML & ""
HTML = HTML & ""
MyMail2.From= "
test@hichina.com"
MyMail2.To=test@net.cn
MyMail2.Subject="Test mail in HTML"
MyMail2.BodyFormat=0
MyMail2.MailFormat=0
MyMail2.Body = HTML
MyMail2.Send
set MyMail2=nothing
%>

总之,用标准的HTML写就是了。如何使用CDONTS组件发含附件的信件?

<%
Set MyMail3 = CreateObject("CDONTS.NewMail")
MyMail3.From= "
test@hichina.com"
MyMail3.To= "
test@net.cn"
MyMail3.Cc="
test@com.cn"
MyMail3.Subject="This is a Test"MyCDONTSMail3.AttachFile Server.MapPath("C:\inetpub\wwwroot\somedirectory\anyfile.txt")
MyBody2 = "Thank you!" & vbCrLf
MyBody2 = MyBody2 & "Your information will be send to me!" & vbCrLf
MyBody2 = MyBody2 & "Welcome in
http://service.hichina.com !"
MyMail3.Body= MyBody2
MyMail3.Send
set MyMail3=nothing
%>


如问题还未解决,请联系售后技术支持