我现在要做个取回密码的功能,就是把用户的密码从用户找回密码入口提交到这个mima.asp里,然后自动发送一封包含会员密码的邮件,我已经测试直接打上制定email地址能正常收到邮件,但是换成动态变量的就收不到邮件了。我判断是收件人地址没有正确获取到的原因,还有就是密码是md5加密的,怎么把他调出来,然后转换成明文送到会员的邮箱里去呢,我不知道怎么弄,折腾一天了,我是个新手,麻烦高手帮忙看看啦!
以下是:mima.asp文件
<!--#include file="conn.asp"-->
<!--#include file="inc/md5.asp"-->
<%
if request("action")="find" then
'取的丢失密码帐户的EMAIL地址
set rs=server.createobject("adodb.recordset")
username=request("username")
Username=replace(Username,"'","")
sql="select email,Password from consumer where email='"&username&"'"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
response.redirect "err.html"
response.end
end if
'Password=md5(Password) '模拟使用MD5加密
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
' JMail.ISOEncodeHeaders = False ' 是否进行ISO编码,默认为True
JMail.From = "****@qq.com" ' 发送者地址
JMail.FromName = "kaixin" ' 发送者姓名
JMail.Subject = "您的密码找回邮件JMail邮件测试" ' 邮件主题
JMail.MailServerUserName = "****" '身份验证的用户名
JMail.MailServerPassword = "****" ' 身份验证的密码
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
FriendEmail=""&Rs("email")&"" '接收人邮件地址
JMail.AddRecipient(FriendEmail)
MailBody = MailBody & "<html><head><META content=zh-cn http-equiv=Content-Language><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312""><style type=text/css>BODY {FONT-SIZE: 9pt}</style></head><body>"
MailBody = MailBody & "您的密码是:"&Rs("Password")&""
MailBody = MailBody & "</body></html>"
JMail.HTMLBody = MailBody
JMail.Body = "我们的邮件采用了HTML格式,但是您的邮件查看软件可能不支持。。。"
JMail.Send("smtp.qq.com")
' 关闭并清除对象
JMail.Close()
Set JMail = Nothing
'设置发信人
response.redirect "mima.asp?ok=ok"
end if
%>
以下是取回密码入口表单部分:
<table border="0" cellspacing="1" cellpadding="0" width="563" >
<tr >
<td >
<%if request("ok")<>"ok" then%>
<form name="formusername" action="mima.asp" method="post">
<table width="543" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td background="gif/seapassline.gif"> <br> <br>
<table width="200" border="0" cellspacing="0" cellpadding="0" height="69" align="center">
<input type="hidden" name="module" value="getpwd">
<input type="hidden" name="submitusername" value="确定">
<tr>
<td>用户名:
<input name="username" type="text" id="username" size="18" maxlength="32">
<input type="hidden" name="action" value="find">
<input type="image" name="img1" src="images/gonext.gif" border=0>
</td> </tr> </table> </td> </tr>
</table>
</form>
<%else%>