protected void btnSendPwd_Click(object sender, EventArgs e) { try { DataSet dsUserPwd = objUserregBL.USP_GetPasswordByID(txtForgetUserName.Text); if (dsUserPwd.Tables.Count > 0) { if (dsUserPwd.Tables[0].Rows.Count > 0) { clsMailFormats format = new clsMailFormats(); string LoginPassword = dsUserPwd.Tables[0].Rows[0]["Pwd"].ToString(); String LoginUserID = dsUserPwd.Tables[0].Rows[0]["UserID"].ToString(); MailMessage msg = new MailMessage(); msg.From = new MailAddress(CommonVariable.FromInfoMail); msg.To.Add(txtForgetUserName.Text); msg.Bcc.Add(CommonVariable.ArchieveMail); msg.Subject = "Forgot Password"; msg.IsBodyHtml = true; string text = string.Empty; text = format.SendForgetPassword(LoginUserID, LoginPassword, ref text); msg.Body = text.ToString(); SmtpClient smtp = new SmtpClient(); //smtp.Host = "smtp.gmail.com"; //smtp.Port = 587; //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "hugomirad"); //smtp.EnableSsl = true; //smtp.Send(msg); smtp.Host = "127.0.0.1"; smtp.Port = 25; smtp.Send(msg); mpeChangePW.Hide(); mpealteruser.Show(); lblErr.Visible = true; lblErr.Text = "Password send to your mail id"; } else { mpeChangePW.Hide(); mpealteruser.Show(); lblErr.Visible = true; lblErr.Text = "No user exists with " + txtForgetUserName.Text; } } else { mpeChangePW.Hide(); mpealteruser.Show(); lblErr.Visible = true; lblErr.Text = "No user exists with " + txtForgetUserName.Text; } } catch (Exception ex) { } }