Link to home
Start Free TrialLog in
Avatar of willa666
willa666Flag for United States of America

asked on

Retrieve forgotten Password

I want to create a page  that the user inputs their emaill address and then the page will search a table called user for that emaill address and then email their password to their emaill address.

I am using classic ASP not .NET with a SQL backend.

Is their an extentsion that is avvalible or is it a hardcoding job?

willa

ASKER CERTIFIED SOLUTION
Avatar of rockmansattic
rockmansattic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rockmansattic
rockmansattic

The way I would tackel it via hand codeing would be somthing like this:

<%
If Request.ServerVariables("Request_Method") = "POST" then

'get the text form emailaddress and saves it to a variable
var_emailaddress = request.form("emailaddress")

'connect to your database
'then run this sql

SELECT emailaddress, password  FROM users WHERE emailadress LIKE 'var_emailaddress'


'then you will have to find wheather the emailaddress is valid
'if so then set teh  password to variables and send email

if (yourrecordsetname).Fields.item("emailaddress").Value <> "" then

var_password = (yourrecordsetname).Fields.item("password").Value

Dim objMail
Dim strBody

 Set objMail = Server.CreateObject("CDONTS.NewMail")

    objMail.From    = "your email address"
    objMail.Subject = "your password"
    objMail.To      = var_emailaddress


     

     HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
     HTML = HTML & "<html>"
     HTML = HTML & "<head>"
     HTML = HTML & "<title>Sending Email</title>"
     HTML = HTML & "</head>"
     HTML = HTML & "<body bgcolor=""FFFFFF"">"
     HTML = HTML & "<p align = ""center"">This email has been auto-generated; Please do not respond.</p>"
     HTML = HTML & "</body>"
     HTML = HTML & "</html>"

     objMail.BodyFormat=0 '0= HTML, 1=Text
     objMail.MailFormat=0


     objMail.Body = HTML
    objMail.Send

Response.write("Mail was Sent")


 set objMail = nothing

'redirect to your password has been sent page ro something
Response.Redirect("password_sent")

'ends the valid email and sends email
end if

'emai wasnt valid
else
  response.redirect("wrong_email.html")

end if




this is a rough guidline and was written without testing, becasue I dont know how you are connecting the sql with asp, and the connection names would be a mess.  
I hope this gets you in the right direction.

Rockman





Avatar of willa666

ASKER

JI rockman

Thanks matey thank works a treat!

wila :)