CDONTS.NewMail发信函数
上次没有写好,一直不支持HTML格式,今天重新整理了一下,写成了函数.
使用方法很简单.
sendEmail(fromMe,tofisker,Subject,Body)
我一直想玩Jmail收信,有谁知道哪里有支持Jmail.POP3的服务器?
Dim fromMe,tofisker,Subject,Body
fromMe = "no-replay@google.com"
tofisker = "lionkay@gmail.com"
Subject = "Testing CDONTS.NewMail Subject"
Body = "The body maybe should be longer。
So,here is a advertisement,
<b>fisker</b> : <a href=""http://www.x2y2.com/fisker/"" target=""_blank"">http://www.x2y2.com/fisker/</a>"
testFlag=sendEmail(fromMe,tofisker,Subject,Body)
If testFlag<>"0" Then
response.write "发送失败,错误代码:"&testFlag
Else
response.write "发送到"&tofisker&"成功."
End if
Function sendEmail(MailFrom,MailTo,MailSubject,MailBody)
'// CDONTS.NewMail发信
'// fisker整理 2007-1-22
On Error Resume Next
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = MailFrom '发件人地址
objCDOMail.To = MailTo '收件人地址
objCDOMail.BodyFormat=0 '邮件格式 0=支持HTML,1=纯文本(默认)
objCDOMail.MailFormat=0 '编码设置 0=采用MIME格式,1=连续的纯文本(默认)
objCDOMail.Importance = 2 '邮件的重要性 0=重要性低,1=重要性一般(默认),2=重要性高
objCDOMail.Subject = MailSubject'邮件主题
objCDOMail.Body = MailBody '邮件内容
objCDOMail.Send '发送邮件
If Err Then
sendEmail=err.description
err.clear
else
sendEmail=0
End If
Set objCDOMail = Nothing '释放对象
End Function
评论Feed: http://ifisker.com/blog/feed.asp?q=comment&id=870
引用链接: loading...
这篇日志没有评论.

