i have a relation about user details,when user click on forget and give registered mail it sends to that mail how to do this with checking mail is recorded or not with some more restrictions
help me
Send automated reply ?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

sonal saxena13 reputationPosted Dec 25, 2009, 7:37 PM EST
thnks
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 25, 2009, 7:41 PM EST
Here I Coded How to Achieve that you want.
protected void btnResetPassword_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Your Connection String");
con.Open();
SqlCommand comm = new SqlCommand("select * from userDetail where email='" + txtMail.Text + "'", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
if (dt.Rows.Count > 0)
{
// Reset the password bu Updating the Password Field in Database
//Build Random Password for User to Send it in Mail
Random r = new Random();
string newPasword = "";
for (int i = 0; i <= 5; i++)
{
newPasword += r.Next(65, 90);
}
comm = new SqlCommand("update UserDetails set password='" + newPasword + "' where email='" + txtMail.Text + "'", con);
comm.ExecuteNonQuery();
con.Close();
// Now Send the New password to user By
//Code to Send mail Hope you know the code to send mail
}else
{
//Warn user that Email Not found In Database
Response.Write("Email Not found In Database!!");
}
}