E-Mail retrieval script problems

T

TJ Seagert

I don't think this belongs here but I've been searching and I can't find
where to post this ASP code.

I'm trying to have a script for people that forget their password to enter
the e-mail and then have their password e-mailed to them. both fields are
stored in access.

This is my script; I need it to be able to authenticate the e-mail it sends
so that the user can recieve the e-mail.
-----------------------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<!--#Include file = "../common/dbdsninc.asp"-->

<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->

<%
'*************************************************************************************************************************
'Mod History
'2004/11/15 - updated then mail server pri2.lake-erie.net to
mail.lake-erie.net
'2004/11/14 - fixed line 93
'2004/11/11 - created
'*************************************************************************************************************************

if len( request.form("member") ) then

if LookupPWD() <> "" then
pwd = LookupPWD()
ToA=request.form("member")
blnSent = SendMail()

if blnSent = "OK" then
response.write "<center><font size='3' color='blue' ><i>Your password
has been sent!<br><br><A href=""http://www.LEJGA.org"">To return to the home
page, click here.</a></i></font></center>"
else
response.write "<center><font size='3' color='blue' ><i>Email was not
sent! Please try again </i></font></center>"
end if
else
response.write said:
<i><br><br>Error<br><br>More than one occurrence of this email address
exists<br>or<br>no matching email address was
found.</i></font></center><br><br>"
Call EmailScreen()
end if

else
Call EmailScreen()
End if


'******************************************************************
Function LookupPWD()
'
'PURPOSE: retrieve password for given email address
'
'PARAMETERS: none
'******************************************************************

Set rs = Server.CreateObject("ADODB.RecordSet")
SQL= "Select * FROM Participants00 where Lcase(trim(email))= '" &
Lcase(trim(request.form("member"))) & "'"
rs.Open SQL,conn,adopenstatic
numRecords= rs.recordCount

if numRecords = 0 then
LookupPWD = ""
else
LookupPWD = rs("Password")
end if
rs.close
set rs=nothing

End Function


'******************************************************************
Function EmailScreen()
'
'PURPOSE: display form entry screen
'
'PARAMETERS: none
'******************************************************************

%>
<div align="center">
<form action="<%=strScriptName%>" method="POST">
<center><font size='3' color='blue' ><i>
To retrieve your lost password,<BR>Please enter your email address.<br><br>
</i></font></center>
<input type="text" name="member" size="25"><br><br>
<input type="submit" value="Submit">
</form>
</div>
<%
response.end
End Function

'******************************************************************
Function SendMail()
'
'PURPOSE: CDO Mail to send emails
'
'PARAMETERS: none
'******************************************************************
sFrom=Request.form("member")
Subject="LEJGA Message"
myBody = Subject & Chr(10) & Chr(13) & vbnewline &_
"Your LEJGA account password is: " & pwd & Chr(10) & Chr(13) &
vbnewline &_
"To register for the current year go to:
http://www.LEJGA.org/asp/personalreglogin.asp" & vbnewline &_
vbnewline &_
"To sign up for tournaments go to (You must be registered for the
current year): http://www.LEJGA.org/asp/cart.asp " & vbnewline &_
vbnewline &_
"Note: This password is only needed to register for the current year and
to register for tournaments to pay via PayPal." & vbnewline &_
vbnewline &_
"Remember, never give out your password to anyone." & vbnewline &_
vbnewline &_
"This message was sent automatically, please do not reply to it."


If Not (request.servervariables("LOCAL_ADDR")="127.0.0.1") then

Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iConf
Set iConf = CreateObject("CDO.Configuration")

Dim Flds
Set Flds = iConf.Fields

With Flds
' assume constants are defined within script file
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail.lake-erie.net"
.Item(cdoSMTPConnectionTimeout) = 20 ' quick timeout
.Item(cdoURLGetLatestVersion) = True
.Update
End With

With iMsg
Set .Configuration = iConf
.To = ToA
.From = sFrom
.Subject = Subject
.TextBody = Mybody
.Send
End With

Set iConf = nothing
Set iMsg = nothing

SendMail = "OK"
else
Call SendMailtest(sFrom, ToA, Subject, Mybody)
SendMail = "OK"
End if

End function
'******************************************************************
Function SendMailtest(sFrom, ToA, Subject, Mybody)
'
'PURPOSE: test Mail without component
'
'PARAMETERS: as shown
'******************************************************************
Response.Write ("To = " & ToA & "<br>")
Response.Write ("From = " & sFrom & "<br><br>")
Response.Write ("Subject = " & Subject & "<br><br>")
Response.Write ("Body =" & Chr(10) & Chr(13) & Mybody & "<br>")
End function
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top