Home > ASP Development > Newbie Help - Sending a User a Forgotten Password

Newbie Help - Sending a User a Forgotten Password



Hello everyone. This is my first post and I could use any help you are willing to give me. I am trying to send a user a forgotten password. I'm posting the code below to show you exactly how I'm trying to do it. Basically, a user enters in an e-mail address that is their username and kept on in a mySQL database. The queery executes and checks to see if the e-mail adddress is on file. If it is, it grabs the corresponding password and sends it through e-mail. Here is my code:




Code:


<%
DIM strEmail
strEmail = Request.Form("Email")

IF strEmail <> "" THEN
%>
<!--I use a separate asp file to make my connection to the
database-->
<!--#include virtual="***/***/connection.asp" -->
<%
DIM mySQL, objRS
mySQL = "SELECT * FROM userlist WHERE username = '" &
strEmail & "'"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn

IF objRS.EOF THEN
Response.Write "That email address was not found in our
database. Please click Back on your browser and
enter the email address you registered with."
ELSE
DIM strPassword
strPassword = objRS("passw")

DIM mail, objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.Subject = "Your Password"
objMail.From = "me@myemail.com"
objMail.To = strEmail
objMail.Body = "Here is your login password: " & strPassword
objMail.Send
Set objMail = nothing

IF NOT objMail.Execute THEN
'Response.Write ("ERROR MESSAGE: " & objMail.ErrorMessage
& "<BR>" & vbcrlf)
ELSE
Response.Write "Your password has been sent to your email
address on file."
END IF

ELSE
Response.Write "Please click Back on your browser and
enter the email address you registered with."
END IF
%>








The error message I keep receiving is the following:



Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/***/***/confirm.asp, line 21

800401f3



I have researched the error and found that it could be because of some DLL files that are not installed on my web server. Does this seem possible? If so, does anyone know what DLL files I need to install.



Again, any help someone could give is appreciated.



Thanks,



jcrab

    
Guest


what server is your site hosted on? ... Windows 2003 requires CDO and not CDONTS

Was this answer helpful ? Yes No   
Guest


I did not know that. I'm on a Windows 2003 Server. I will try chaning from CDONTS to CDO and see what happens. Thank you for your help.

Was this answer helpful ? Yes No   
Guest


k ... let us know if you run into any problems.

Was this answer helpful ? Yes No   
Guest


Some basic CDO examples

http://www.w3schools.com/asp/asp_send_email.asp

Was this answer helpful ? Yes No   
Guest


Just as a note, it is usually recommend to store passwords in encrypted or hashed form. Instead of sending the pass a new random pass would be created and sent to the user. The user can then login to change their pass.



This is for security purposes, probably so the users pass is not being sent/displayed as it could be captured by others.

Was this answer helpful ? Yes No   
Guest


I just got it to work using CDO. Thanks again for all of your help.



I have another issue now, though. I would like to send a text message through the web using the same code. This is for demo purposes only, so don't worry about security things. I will be taking everything down off the web server after I demo it.



Anyway, I know that text messaging is basically sending an e-mail to the phone using the cell phone number as the hostname and a SMTP address that is used by a cell phone company. I inputted my cell phone number into the database (i'm a cingular customer) so it looks like this:



1234567890@mobile.mycingular.net



This is the error message I get:



error '8004020f'



There is no text after the error...just that. I figure IIS is throwing this error, but I'm not sure how to fix it. Are there any workarounds? If so, can anyone show me an alternative way to text message through the web?



Any help is always appreciated.



Thanks,



jcrab

Was this answer helpful ? Yes No   
Guest


try posting some code here!

also searching on google might help........ i did and found nothing concrete, but may be this gives u any ideas.

This Link

Sorry if it doesnt help!



Edit: if u happen to send message to cell phone through asp, please let me know....... i also wanna try it

Was this answer helpful ? Yes No   
Guest


Here is the code I have currently:




Code:



<%
DIM strEmail
strEmail = Request.Form("Email")

IF strEmail <> "" THEN
%>
<!--#include virtual="connection.asp" -->
<%
DIM mySQL, objRS
mySQL = "SELECT * FROM userlist WHERE username = '" &
strEmail & "'"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, objConn

IF objRS.EOF THEN
%>That email address was not found in our database.<br />
Please click Back on your browser and enter the email address
you registered with.<%

ELSE
DIM strPassword, objCDOMail, objConfig, Fields, sch, strBody
strPassword = objRS("passw")
strBody = "Here is your login password: " & strPassword

Set objCDOMail = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
sch = "http://schemas.microsoft.com/cdo/configuration/"

With Fields
.Item(sch & "sendusing") = 1
.Item(sch & "smtpserver") = "smtp.email.com"
.Item(sch & "smtpserverport") = 25
.Item(sch & "smtpconnectiontimeout") = 10
.Item(sch & "smtpauthenticate") = 1
.Item(sch & "sendusername") = "username"
.Item(sch & "sendpassword") = "password"
.Update
End With

'################################################# #########

With objCDOMail
Set .Configuration = objConfig
.From = "email@emal.edu"
.To = strEmail
.Subject = "Your Password"
.TextBody = strBody
<--Below is Line 48 where error is thrown-->
.Send
End With

'### clean up section ####
Set objCDOMail = Nothing
Set Fields = Nothing
Set objConfig = Nothing

%>Your password has been sent to your email address on
file.<%
END IF
ELSE
%>Please click Back on your browser and enter the email
address you registered with.<%
END IF
%>






The error I get is the following:



error '8004020f'

/confirm_textmsg.asp, line 48



I think this has something to do with IIS, but I'm not sure. This site is hosted on a remote server, so I would have to contact the guy running it to make any changes if need be. I have tried to change the 'CDOSendUsing' option to 1 and specifying a Pickup, but of course I don't know what the pickup would be. Anybody know a default Pickup for IIS 6.0?



Any help is appreciated.



Thanks,



Josh

Was this answer helpful ? Yes No   
Guest


try changing this:


Code:


.Item(sch & "smtpserver") = "smtp.iu.edu"




to this:


Code:


.Item(sch & "smtpserver") = "localhost"




and/or this:

Code:


.Item(sch & "smtpauthenticate") = 1 




to this:

Code:


.Item(sch & "smtpauthenticate") = 0 



Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved