protected void btnSubmit_Click(object sender, EventArgs e) { intVaidError = 0; if (!IsEmailValid(txtEmail.Text.ToString())) { intVaidError++; strErrorMessage += "<img src='image/warning.png' height='25px' width='25px' /> E mail address is not valid.<br />"; } MailCheck(); if (intMailAvail == 0) { intVaidError++; strErrorMessage += "<img src='image/warning.png' height='25px' width='25px' /> E mail address does not exists.<br />"; } if (intVaidError == 0) { try { string serverPath = ConfigurationManager.AppSettings["ApplicationPath"].ToString() + "/Login.aspx"; DataTable dtCV = null; ServeAtDoorstepService obj = new ServeAtDoorstepService(); if (sType == "cus") dtCV = obj.ForgotPasswordCus(txtEmail.Text.Trim()); else if (sType == "ven") dtCV = obj.ForgotPasswordVen(txtEmail.Text.Trim()); string sLoginName = ""; string sLoginPassword = ""; if (dtCV.Rows.Count>0) { sLoginName = dtCV.Rows[0][""].ToString(); sLoginPassword = dtCV.Rows[0][""].ToString(); } ServeAtDoorstepData.SendMailDetails objMail = new ServeAtDoorstepData.SendMailDetails(); objMail.MailID = txtEmail.Text.Trim(); objMail.MailSubject = "Serve At Doorstep Password request"; objMail.MailContent = "<html><body><form id='form1' runat='server'><div>" + "Dear " + sLoginName + ",<br /><br />As you request, your username and password is given below:<br><br>" + "<b>UserName : "******"<br>Password : "******"</b>" + "<br /><br />Now you can login with Serve At Doorstep<br />" + "<a href='" + serverPath + "' runat='server' >" + serverPath + "</a>" + "<br /><br />All the best,<br />Serve At Doorstep.</div></form></body></html>"; obj.DoSendMail(objMail); divMessage.InnerHtml = "Password sent to your " + txtEmail.Text + ".<br/><img src='image/Mail Reply.png' height='25px' width='25px' /> Goto your inbox"; txtEmail.Text = ""; } catch (SqlException sqlEx) { divErrorMessage.InnerHtml = "<img src='image/warning.png' height='25px' width='25px' /> " + sqlEx.Message.ToString(); } catch (Exception ex) { divErrorMessage.InnerHtml = "<img src='image/warning.png' height='25px' width='25px' /> " + ex.Message.ToString(); } } else { divErrorMessage.InnerHtml = strErrorMessage; } }