protected string SendMail(string passWord, string userName, string strEmailid) { try { if (!string.IsNullOrEmpty(strEmailid)) { //string strSubject = "Dear Sir/Madam, \n\n Please keep a note of the following information which is critical for ensuring uninterrupted access to HiDOCTOR \n\n Your User Id: " + UserName + " \n Your Password: "******" \n\n In case of any clarifications, please reach out to our support desk ([email protected] or 095600005628).\n\n Assuring you of our best services at all times.\n\n Warm Regards \n Customer Service "; string companyName = ""; string employeeName = ""; string phoneNo = "Not yet registered in HiDOCTOR"; string mobileNo = "Not yet registered in HiDOCTOR"; DataSet dsEmpInfo = new DataSet(); BLUser objBLuser = new BLUser(); try { _objData.OpenConnection(_objcurrentInfo.GetCompanyCode()); // dsEmpInfo = _objData.ExecuteDataSet("EXEC SP_HdGetEmployeeDetail " + "'" + _objcurrentInfo.GetCompanyCode() + "','" + userName + "'"); dsEmpInfo = objBLuser.Getempinfo(Session["Comp_Code"].ToString(), userName); } finally { _objData.CloseConnection(); } if (dsEmpInfo.Tables[0].Rows.Count > 0) { companyName = dsEmpInfo.Tables[0].Rows[0]["Company_Name"].ToString().Trim(); employeeName = dsEmpInfo.Tables[0].Rows[0]["Employee_Name"].ToString().Trim(); if (dsEmpInfo.Tables[0].Rows[0]["Phone"].ToString().Trim().Length > 0) { phoneNo = dsEmpInfo.Tables[0].Rows[0]["Phone"].ToString().Trim(); } if (dsEmpInfo.Tables[0].Rows[0]["Mobile"].ToString().Trim().Length > 0) { mobileNo = dsEmpInfo.Tables[0].Rows[0]["Mobile"].ToString().Trim(); } } string server = ConfigurationManager.AppSettings["SMTPSERVER"]; string frommail = ConfigurationManager.AppSettings["FROMMAIL"]; string strSubject = Resources.Password_Policy_Messages.PasswordLockReleaseMail.ToString(); string strSubjectNew = strSubject.Replace("@Name", userName).Replace("@Pass", passWord); strSubjectNew = strSubjectNew.Replace("@CompanyName", companyName); strSubjectNew = strSubjectNew.Replace("@EmployeeName", employeeName); strSubjectNew = strSubjectNew.Replace("@PhoneNo", phoneNo); strSubjectNew = strSubjectNew.Replace("@MobileNo", mobileNo); bool Issmtpmail = false; Issmtpmail = _objSPData.SendMail(strEmailid, "Check your HiDOCTOR Password", strSubjectNew); return("SUCCESS"); } else { return("MAIL"); } } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); dicContext.Add("Filter:UserName", userName); dicContext.Add("Filter:UserName", passWord); dicContext.Add("Filter:UserName", strEmailid); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); throw new Exception("Sorry an error occurred. Please try again later"); } }