Reply to topic
Email Generated Password to Members
olu


Joined: 20 Aug 2004
Posts: 7
Reply with quote
Any idea how this is done?
MBMunday


Joined: 06 Apr 2004
Posts: 76
Location: Dallas/Fort Worth
Reply with quote
Classic ASP or .NET?

MB
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
Yes...

Code:
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!!!
Email Generated Password to Members
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic