Fernand St-Georges
|
Posted: 07/04/2009, 1:51 PM |
|
Hi
I have a problem here.. I want to send an email to a user who has forgotten
his password. The email exist's in the database, same as the password. I'm
using APS coding. Can someone indicate the appropriate manner?
Thanks
Fernand
|
|
|
mhope
Posts: 37
|
Posted: 07/06/2009, 7:59 PM |
|
A simple one would be to use their email address as a select statement against the database... if found send email out, but that is a very basic implementation... much better ones can be done, but this is a start for you
Like below:
Dim SQL, RS1, Conn
Set Conn = New clsDBintranet
Conn.Open
SQL = "SELECT Password FROM address WHERE Email='" & Request.Form("Email") & "'"
Set RS1 = Conn.Execute(SQL)
If RS1.eof then
Response.Redirect "Pass.asp?Error=1"
Else
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "localhost" ' Specify a valid SMTP server
Mail.From = "support@yoursite.com" ' Specify sender's address
Mail.FromName = "Support" ' Specify sender's name
Mail.AddAddress RS1("Email"), ""
Mail.AddReplyTo "support@yoursite.com"
Mail.Subject = "Account Details"
Mail.Body = "Here are your login details:" & Chr(13) & Chr(10) & Chr(13) & Chr(10)& _
"Password: " & RS1("Password") & Chr(13) & Chr(10) & _
"Email/Login: " & RS1("Email") & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
"Regards," & Chr(13) & Chr(10) & _
"Support"
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Redirect "Pass.asp?E=2&Message=" & Err.Description
End If
RS1.Close
Set RS1 = Nothing
Conn.Close
Set Conn = nothing
Response.Redirect "YourPage.asp"
End If
|
|
|
|
|
|
|
|