Q:

Send Password if user forgets

I'm working on a project with asp and i have a section of where a user forgets his or her password she enters her email and if it's valid it sends the password. Now the problem is, its able to check if the email is in the database alright and sends the mail, but can't send the password along. 
<%

'Check if the form has been processed
If Request.Form("process")="true" Then
  'Check the recordset for a valid record

  If Not rs_user.Eof Then
    'Valid record, so proceed with the email
    Call sSendReminder (rs_user("email"), rs_user("password"))
    Response.Write "Your password has been sent to your inbox. If you don't find it in your mail box, check your junk mail folder" 

     dim sName, sEmail, sMessage
    dim oCdoMail, oCdoConf, sConfURL

    sEmail = Request.Form("email")

        Set oCdoMail = Server.CreateObject("CDO.Message")
        Set oCdoConf = Server.CreateObject("CDO.Configuration")

        sConfURL = "http://schemas.microsoft.com/cdo/configuration/"

        with oCdoConf
            .Fields.Item(sConfURL & "sendusing") = 2
            .Fields.Item(sConfURL & "smtpserver") = "smptserveraddress.com"
            .Fields.Item(sConfURL & "smtpserverport") = 25
            .Fields.Update

        end with

        with oCdoMail
            .From = "noreply@sample.com"
            .To = sEmail
            .Subject = "Password Recovery from samplesite"
            .TextBody = "Your password is: " & password
            .HTMLBody = "Your password is: " & password
            .Configuration = oCdoConf
            .Send
        end with

        Set oCdoConf = Nothing
        Set oCdoMail = Nothing

  Else
    'Not a valid record
    Response.Write "Sorry, no email was found."
  End If
End If 

        Sub sSendReminder(email, password)

End Sub

%>

A:

Is the above code the exact code you are running? 
If so, you need to move the 
Sub sSendReminder(email, password)

above
dim sName, sEmail, sMessage 

You also need to move those "end if" statements outside the sub.
Your code runs (I think) because it is technically correct, but it doesn't run like you think it should because your sub is actually blank.
Correct code would look like this:

<%

'Check if the form has been processed
If Request.Form("process")="true" Then
  'Check the recordset for a valid record


If Not rs_user.Eof Then
    'Valid record, so proceed with the email
    Call sSendReminder (rs_user("email"), rs_user("password"))
    Response.Write "Your password has been sent to your inbox. If you don't find it in your mail box, check your junk mail folder" 
 Else
    'Not a valid record
    Response.Write "Sorry, no email was found."
  End If
End If 
 
 
 
Sub sSendReminder(email, password)

     dim sName, sEmail, sMessage
    dim oCdoMail, oCdoConf, sConfURL


    sEmail = Request.Form("email")


        Set oCdoMail = Server.CreateObject("CDO.Message")
        Set oCdoConf = Server.CreateObject("CDO.Configuration")

        sConfURL = "http://schemas.microsoft.com/cdo/configuration/"



        with oCdoConf
            .Fields.Item(sConfURL & "sendusing") = 2
            .Fields.Item(sConfURL & "smtpserver") = "smptserveraddress.com"
            .Fields.Item(sConfURL & "smtpserverport") = 25
            .Fields.Update


        end with

        with oCdoMail
            .From = "noreply@sample.com"
            .To = sEmail
            .Subject = "Password Recovery from samplesite"
            .TextBody = "Your password is: " & password
            .HTMLBody = "Your password is: " & password
            .Configuration = oCdoConf
            .Send
        end with

        Set oCdoConf = Nothing
        Set oCdoMail = Nothing
End Sub %>

