CDOSYS.DLL真的很错吗?老是收到同一时间发送的邮件若干封
我用如下代码发送邮件,可是在我的邮箱里老是收到很同一邮件,发送时间都是一样的
<!--#include file="../inc/conn.asp"-->
<%
dim email,username,password
email=request("email")
dim rs, sql
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from [Author_users] where email='"&email&"' and userName<>'' order
by ID desc"
rs.Open sql,conn,1,1
username=rs("username")
password=rs("password")
Dim cm
'创建对象
Set cm=Server.CreateObject("CDO.Message")
'设置发信人的邮箱
cm.From="dfhm@test.com"'"from@test.com"
'设置收信人的邮箱
cm.To=email
'设定邮件的主题
cm.Subject="Username and password"
'cm.TextBody="http://www.knowsky.com/rss/"
'上面是使用普通的文本格式发送邮件,只能是文字,不能支持html,所以这里不用
cm.HtmlBody="Your login information to access , Online Peer Review system for the
Canadi an Geotechnical Journal.<p>"&_
"username:"&username&"<br/>"&_
"password:"&password&"</p><p>"&_
"Please note: the username and password are case sensitive.Please store this info
rmation in a safe place."&_
"If you wish to change your username and password or contact information please
s"&_
"elect '&change your details' from the main page after you have logged in."
'上面就是你构建的html正文,这样发出的邮件就比只有文字的好看多了。不要说你不会html
吧
'cm.AddAttachment Server.MapPath("test.zip")
'如果有需要发送附件的话就用上面的方法把文件附加进去。
cm.Send
'最后当然是执行发送了
Set cm=Nothing
'发送成功后即时释放对象
Response.Write("发送邮件成功。")
rs.close
set rs=nothing
%>