First, you will need to create your database in MS Access 97 or 2000. Name your database "membersdb.mdb". Create the table "MEMBERS" with the fields USERNAMES, EMAIL & PASSWORD. Second, create "EnterEmail.htm" to let the visitor enter their email if they are registered with your database. For this example I am using the database I created in MS Access 2000.
E-mail Address:

Finally, we are going to create the ASP file that will verify the email address in the Access database and email the password. Call the file "EmailPassword.asp" <% ' Begin %> <%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit %> <% Dim DATA_PATH, Conn, DataRecords, email, user, pass, sendmail 'Maps to database. Change to your database path. DATA_PATH=Server.Mappath("membersdb.mdb") ' Create and intiate data connection Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionTimeout = 15 Conn.CommandTimeout = 30 Conn.Open "DBQ=" & DATA_PATH & ";Driver={Microsoft Access Driver (*.mdb)}; DriverId=25;MaxBufferSize=8192;Threads=20;", "admin", "password" Set DataRecords = Server.CreateObject("ADODB.Recordset") email=request.form("email") 'The magic query to look for registered members in the database DataRecords.Open "SELECT * FROM MEMBERS WHERE email = '" & email & "'", Conn, 0, 1 %> Send Password <% 'checks if email address exists in the database before sending a message. if DataRecords.EOF then %>
Invalid Email Address

We could not find <%=email%> in our database.

<% Else %> <% 'sets variables email = request.form("email") 'chooses username and password from database that correspond to submitted email address. user = DataRecords.Fields("username") pass = DataRecords.Fields("password") Set sendmail = Server.CreateObject("CDONTS.NewMail") 'put the webmaster address here sendmail.From = "support@yourdomain.com" 'The mail is sent to the address entered in the previous page. sendmail.To = email 'Enter the subject of your mail here sendmail.Subject = "Membership Login Information" 'This is the content of thr message. sendmail.Body = "Per your request your account login information is: " & vbCrlf & vbCrlf _ & "Username=" & user & vbCrlf _ & "Password=" & pass & vbCrlf 'this sets mail priority.... 0=low 1=normal 2=high sendmail.Importance = 3 sendmail.Send %>

We just sent your login information to <%=email%>.
You should receive it shortly.

<% ' Close Data Access Objects and free connection variables Conn.Close Set DataRecords = Nothing Set Conn = Nothing Set sendmail = Nothing %> <%end if%>