Forums
This topic is locked
Lost Password tutorial?
12 Dec 2002 21:41:32 Jim Penn posted:
Hi all and thanks in advance for your time.I have 3 pages done for a user re retrieve their password. I used the tutorial from www.udniewbie.com
The problem is that it wont send the password! If you type in wrong UserName it tells you that the name doesn't exist and if you type in the right username it DOES send an e-mail but the password isn't in it.
Here is the code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/dealer.asp" -->
<%
Dim rsEmailPassword__strUserName
rsEmailPassword__strUserName = "xyz"
if (Request.Form("UserName"



%>
<%
set rsEmailPassword = Server.CreateObject("ADODB.Recordset"

rsEmailPassword.ActiveConnection = MM_dealer_STRING
rsEmailPassword.Source = "SELECT * FROM ContactInfo WHERE UserName = '" + Replace(rsEmailPassword__strUserName, "'", "''"

rsEmailPassword.CursorType = 0
rsEmailPassword.CursorLocation = 2
rsEmailPassword.LockType = 3
rsEmailPassword.Open()
rsEmailPassword_numRows = 0
%>
<%
' *** Redirect If Recordset Is Empty
' *** MagicBeat Server Behavior - 2014 - by Jag S. Sidhu - www.magicbeat.com
If (rsEmailPassword.EOF) Then
Response.Redirect("/LostPasswordFailed.asp"

End If
%>
<%
Dim strRecipient
strRecipient = rsEmailPassword.Fields.Item("EMail"

%>
<%
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"

objCDO.From = " "
objCDO.To = strRecipient
objCDO.Subject = "Your Password."
objCDO.Body = "Here is the password you requested"
objCDO.Send()
Set objCDO = Nothing
%>
Can anyone find the mistake or could you recommend another tutorial?
Jim
Edited by - excelsrd on 12 Dec 2002 21:43:02
Edited by - excelsrd on 12 Dec 2002 21:43:42
Replies
Replied 13 Dec 2002 09:39:11
13 Dec 2002 09:39:11 Dave Clarke replied:
Hi
I've never used CDONTS but off hand I'd say that it's because you havent told it to send the password <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Your body text is
objCDO.Body = "Here is the password you requested"
and then you send it, whereas you need something like
objCDO.Body = "Here is the password you requested" & strPassword, so your code would look something like this
<%
Dim strRecipient
strRecipient = rsEmailPassword.Fields.Item("EMail"
.Value
<b>Dim strPassword
strPassword = rsEmailPassword.Fields.Item("Password"
.Value</b>
%>
<%
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"
objCDO.From = " "
objCDO.To = strRecipient
objCDO.Subject = "Your Password."
objCDO.Body = "Here is the password you requested" <b>& strPassword</b>
objCDO.Send()
Set objCDO = Nothing
%>
Like I said I've never used cdonts so that could be hogwash, but seems logical to me
<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
I've never used CDONTS but off hand I'd say that it's because you havent told it to send the password <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Your body text is
objCDO.Body = "Here is the password you requested"
and then you send it, whereas you need something like
objCDO.Body = "Here is the password you requested" & strPassword, so your code would look something like this
<%
Dim strRecipient
strRecipient = rsEmailPassword.Fields.Item("EMail"

<b>Dim strPassword
strPassword = rsEmailPassword.Fields.Item("Password"

%>
<%
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail"

objCDO.From = " "
objCDO.To = strRecipient
objCDO.Subject = "Your Password."
objCDO.Body = "Here is the password you requested" <b>& strPassword</b>
objCDO.Send()
Set objCDO = Nothing
%>
Like I said I've never used cdonts so that could be hogwash, but seems logical to me
<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 26 Dec 2002 21:45:47
26 Dec 2002 21:45:47 Jim Penn replied:
Davecl,
Thanks for the reply. That worked perfectly!
I mesed with it for a couple hours the day you replied but it wouldn't work. I got back to that part today and within 20 minutes ... it worked!
Thank you again,
Jim
Thanks for the reply. That worked perfectly!
I mesed with it for a couple hours the day you replied but it wouldn't work. I got back to that part today and within 20 minutes ... it worked!
Thank you again,
Jim