Yes...
dim strSQL as string = "SELECT Password FROM UserInfoTable WHERE Email=@Email"
dim C as new sqlcommand(strSQL, ConnStr)
dim DR as sqldatareader
dim Password as string
With C.Parameters
.Add(New SQLParameter("@Email", txtEmail.Text))
End With
Conn.Open()
Try
DR = C.ExecuteReader()
If DR.Read Then
Password = DR("Password")
End If
DR.Close()
Catch Exc as Exception
response.write(Exc.ToString.Replace(Environment.NewLine(), "<br />")
End Try
Conn.Close()
dim M as New MailMessage
With M
M.To = txtEmail.Text
M.From = "LostPassword@YourCompany.com"
M.Subject = "Your Password"
M.Body = "Your Password Is: " & Password
M.MailFormat = MessageFormat.Text
...
End With
SendMail.SMTPServer = "ServerAddress"
Try
SendMail.Send(M)
response.write("Your password has been sent to the email address specified.")
Catch Exc as Exception
response.write(Exc.ToString.Replace(Environment.NewLine(), "<br />")
End Try |
Thats in a hurry from the top of my head so don't flame me for any syntax problems... but that's pretty much it!!!