private void sendMailOTP2(string mailid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/VenOTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", PMotp.Value); //body = body.Replace("{UserIP}", Session["TIP"].ToString()); //body = body.Replace("{Usercity}", Session["TST"].ToString()); //body = body.Replace("{UserCountry}", Session["TCOU"].ToString()); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", mailid, "OTP Verification Profile Management", body); s.sendMail(); //MYotpPM.Visible = true; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCodeRegis(string EmailID) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/VenOTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", PMotp.Value); body = body.Replace("{UserIP}", Session["TIP"].ToString()); body = body.Replace("{Usercity}", Session["TST"].ToString()); body = body.Replace("{UserCountry}", Session["TCOU"].ToString()); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", ObjEnc.DecryptData(Session["User"].ToString()), "OTP Verification Add User", body); s.sendMail(); MYotpPM.Visible = true; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmail() { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/CompanyRemarkReply.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{Name}", txtusername.Text); body = body.Replace("{CompanyName}", txtremark.Text); // body = body.Replace("{YourRemark}", txtremark.Text); body = body.Replace("{Reply}", txtreply.Text); SendMail s; s = new SendMail(); s.CreateMail(objCrypto.DecryptData(Session["User"].ToString()), txtemail.Text, "Remark Revert", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Send Successfully!!!')", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCode() { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/Feedback.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{Email}", Txtemail.Text); body = body.Replace("{Name}", TxtBxFirstNm.Text); body = body.Replace("{Phone}", Txtcontact.Text); body = body.Replace("{CompanyName}", ddlcomp.SelectedItem.Text); body = body.Replace("{Description}", TxtBxDesc.Text); SendMail s; if (Txtemail.Text != "") { s = new SendMail(); s.CreateMail(Txtemail.Text, Txtnodalid.Text, "Feedback details", body); s.sendMail(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
protected void SendCloseMail() { try { string body; if (Enc.DecryptData(Request.QueryString["mque"].ToString()) == "FeedBack") { using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/G_CloseTicket.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{ticketno}", hfticketclose.Value); body = body.Replace("{sub}", txtsubject.Text); body = body.Replace("{reply}", txtreply.Text); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", hfemail.Value, "Thanks Mail from Srijan FeedBack " + hfticketclose.Value + ".", body); s.sendMail(); } else { if (chkstatus.SelectedItem.Value == "N") { using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/G_CloseTicket.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{ticketno}", hfticketclose.Value); body = body.Replace("{sub}", txtsubject.Text); body = body.Replace("{issue}", txtquery.Text); body = body.Replace("{reply}", ddlticketstatus.SelectedItem.Text); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", hfemail.Value, "Ticket" + ddlticketstatus.SelectedItem.Text + " " + hfticketclose.Value + ".", body); s.sendMail(); } else { using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/G_CloseTicket.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{ticketno}", hfticketclose.Value); body = body.Replace("{sub}", txtsubject.Text); body = body.Replace("{issue}", txtquery.Text); body = body.Replace("{reply}", ddlticketstatus.SelectedItem.Text); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", hfemail.Value, "Ticket Close " + hfticketclose.Value + ".", body); s.sendMail(); } } } catch (Exception ex) { ex.Message.ToString(); } }
private void sendMailOTP() { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/OTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", PMotp.Value); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", ObjEnc.DecryptData(Session["User"].ToString()), "OTP Verification Profile Migration", body); s.sendMail(); }
private void sendMailOTP2() { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/OTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", PMotp.Value); SendMail M; M = new SendMail(); M.CreateMail("*****@*****.**", VendorEmailID, "We have Migrating Profile With You Please follow Profile Migration", body); M.sendMail(); }
public void SendEmailCode(string empid, string id) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/CartDetail.html"))) { body = reader.ReadToEnd(); } DataTable dtMail = Lo.RetriveMailCart(id); StringBuilder html = new StringBuilder(); html.Append("<table border = '1'>"); html.Append("<tr>"); foreach (DataColumn column in dtMail.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); { for (int m = 0; dtMail.Rows.Count > m; m++) { html.Append("<tr>"); foreach (DataColumn column in dtMail.Columns) { html.Append("<td>"); html.Append(dtMail.Rows[m][column.ColumnName]); html.Append("</td>"); } html.Append("</tr>"); } } html.Append("</table>"); body = body.Replace("{dt}", html.ToString()); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", empid, "Make in India opportunities Information", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Thankyou for your intrest in these product.We will revert you soon')", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('" + ex.Message + "')", true); } }
public bool SendEmailForOTP(string OTP) { try { string body = "Dear,\n\nThis is an Your OTP : '" + OTP + "' For Email Validation. "; SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtnodelemail.Text, "OTP Verification For Email-Id", body); //s.sendMail(); s.sendMail("smtp.gmail.com", 587, "*****@*****.**", "Gip@1234##"); MsgStatus = true; } catch (Exception ex) { lblmsg.Text = ex.Message; ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true); } return(MsgStatus); }
private void sendMailOTP2() { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/OTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", PMotp.Value); SendMail M; M = new SendMail(); M.CreateMail("*****@*****.**", VendorEmailID, "We have Migrating Profile With You Please follow Profile Migration", body); M.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
private void sendMailOTP(string email) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/OTP.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{OTP}", hfotp.Value); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", email.ToString(), "OTP Verification HelpDesk.", body); s.sendMail(); } catch (Exception ex) { ex.Message.ToString(); } }
public void SendMailBLockAccount(string mtimeblock) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/AccountBlock.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", txtUserName.Text); body = body.Replace("{timeblock}", mtimeblock.ToString()); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtUserName.Text, "Account Block", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "ErrorMssgPopup('" + ex.Message + "')", true); } }
public void SendEmailCodeRegis(string empid, string email) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/HelpDeskRegis.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", email); body = body.Replace("{refno}", empid); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtnodelemail.Text, "Registration Email", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCode(string empid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/VendorForgotPassword.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", txtforgotemailid.Text); body = body.Replace("{refno}", HttpUtility.UrlEncode(objEnc.EncryptData(empid))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtforgotemailid.Text, "Forgot Password Recover Mail", body); // s.sendMail(); s.sendMail("smtp.gmail.com", 587, "*****@*****.**", "Gip@1234##"); } catch (Exception ex) { } }
public void SendEmailCode(string empid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/VenRegisOrPassGenerateLink.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", txtemail.Text); body = body.Replace("{refno}", HttpUtility.UrlEncode(Encrypt.EncryptData(empid))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtemail.Text, "Create Password Email", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailOTP(string empid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/OTP.html"))) { body = reader.ReadToEnd(); } ViewState["mOTPKey"] = Resturl(6); body = body.Replace("{OTP}", ViewState["mOTPKey"].ToString()); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", ObjEnc.DecryptData(Session["User"].ToString()), "Vendor Login OTP", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('OTP send Successfully.');", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCode(string empid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/HelpdeskForgotpassword.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", txtforgotemailid.Text); body = body.Replace("{refno}", empid); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtforgotemailid.Text, "Forgot Password Recover Mail", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Email send to your registerd email id successfully.');", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
private void sendMailOTP3(string mailid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/ChangeNodalOfficerEmail.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", VEmailID.Text); body = body.Replace("{refno}", HttpUtility.UrlEncode(ObjEnc.EncryptData(VendorID5))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", VEmailID.Text, "We have add your email ID, Please click on approval Link", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCodeRegistwo(string EmailID2) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/Userupdatepassword.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", VendorEmailID); body = body.Replace("{refno}", HttpUtility.UrlEncode(ObjEnc.EncryptData(Session["NewVendorid"].ToString()))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", VendorEmailID, "New User : RAKSHA UDYOG MITRA PORTAL", body); s.sendMail(); MYotpPM.Visible = true; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCode() { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/GeneratePassword.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", UserName); body = body.Replace("{refno}", objEnc.EncryptData(RefNo)); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", UserEmail, "Create Password", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "SuccessfullPop('Password change mail send successfully.')", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('" + ex.Message + "')", true); } }
private void sendMailOTP3(string mailid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/ProfileMigrationEmail.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", VEmailID.Text); body = body.Replace("{refno}", HttpUtility.UrlEncode(ObjEnc.EncryptData(VendorIMGID))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", VEmailID.Text, "Profile Migration : RAKSHA UDYOG MITRA PORTAL", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCodeRegistwo(string EmailID2) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/ProfileMigrationEmail.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", VendorEmailID); body = body.Replace("{refno}", HttpUtility.UrlEncode(ObjEnc.EncryptData(VendorIMGID))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", VendorEmailID, "We have Migrate your profile Please Resat your password", body); s.sendMail(); MYotpPM.Visible = true; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCodeRegis(string empid) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/VenRegisOrPassGenerateLink.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", Session["NodalOfficerEmail"].ToString()); body = body.Replace("{refno}", HttpUtility.UrlEncode(objEnc.EncryptData(empid))); body = body.Replace("{mcurid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", Session["NodalOfficerEmail"].ToString(), "Create Password Email", body); //s.sendMail(); s.sendMail("smtp.gmail.com", 587, "*****@*****.**", "Gip@1234##"); } catch (Exception ex) { lblmsg.Text = ex.Message.ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "modelmsg", "showPopup();", true); } }
public void SendEmailCode(string refno) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/HelpDeskIssueMail.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{Name}", txtname.Text); body = body.Replace("{Issue}", txtIssueorFeedback.Text); body = body.Replace("{Refno}", refno.ToString()); body = body.Replace("{portal}", ddltype.SelectedItem.Text); body = body.Replace("{rb}", rbselectsub.SelectedItem.Text); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", txtemail.Text, "HelpDesk " + rbselectsub.SelectedItem.Text, body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
public void SendEmailCode(string email) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/FeedbackReply.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{Name}", TxtBxFirstNm.Text); body = body.Replace("{CompanyName}", txtcompname.Text); body = body.Replace("{YourFeedback}", txtusermsg.Text); body = body.Replace("{CompanyReply}", TxtBxDesc.Text); SendMail s; s = new SendMail(); s.CreateMail(Session["User"].ToString(), Txtemail.Text, "Feedback Revert", body); s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('" + ex.Message + "')", true); } }
protected void gvViewDesignation_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditComp") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; string stridNew = Request.QueryString["id"].ToString().Replace(" ", "+"); string mstrid = objEnc.EncryptData((objEnc.DecryptData(stridNew))); string UrlEdit = "Add-Nodal?mrcreaterole=" + HttpUtility.UrlEncode(objEnc.EncryptData(e.CommandArgument.ToString())) + "&mcurrentcompRefNo=" + HttpUtility.UrlEncode(objEnc.EncryptData(e.CommandArgument.ToString())) + "&id=" + mstrid; Response.Redirect(UrlEdit); } else if (e.CommandName == "ViewComp") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; string Role = (gvViewNodalOfficer.Rows[rowIndex].FindControl("hfnodalrole") as HiddenField).Value; if (Role == "Unit") { Role = "UnitID"; } else if (Role == "Division" || Role == "Factory") { Role = "DivisionID"; } else if (Role == "Company") { Role = "CompanyID"; } DataTable DtView = new DataTable(); DtView = Lo.RetriveAllNodalOfficer(e.CommandArgument.ToString(), Role); if (DtView.Rows.Count > 0) { lblcompanyname.Text = DtView.Rows[0]["CompanyName"].ToString(); if (Role == "CompanyID") { lblDivision.Text = ""; } else { lblDivision.Text = DtView.Rows[0]["FactoryName"].ToString(); } if (Role == "DivisionID") { lblUnit.Text = ""; } else { lblUnit.Text = DtView.Rows[0]["UnitName"].ToString(); } lblNodalOfficerRefNo.Text = DtView.Rows[0]["NodalOfficerRefNo"].ToString(); lblNodalOficerName.Text = DtView.Rows[0]["NodalOficerName"].ToString(); //lblDesignation.Text = DtView.Rows[0]["Designation"].ToString(); lblNodalEmpCode.Text = DtView.Rows[0]["NodalEmpCode"].ToString(); lblEmail.Text = DtView.Rows[0]["NodalOfficerEmail"].ToString(); lblMobile.Text = DtView.Rows[0]["NodalOfficerMobile"].ToString(); lblTelephone.Text = DtView.Rows[0]["NodalOfficerTelephone"].ToString(); lblFax.Text = DtView.Rows[0]["NodalOfficerFax"].ToString(); ScriptManager.RegisterStartupScript(this, this.GetType(), "ViewNodalDetail", "showPopup();", true); } } else if (e.CommandName == "DeleteComp") { try { string DeleteRec = Lo.DeleteRecord(e.CommandArgument.ToString(), "InActiveCompany"); if (DeleteRec == "true") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "SuccessfullPop('Record delete succssfully.')", true); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Record not deleted.')", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Record not deleted.')", true); } } else if (e.CommandName == "SendLogin") { try { GridViewRow gvrow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Label lblnodelrefno = (Label)gvrow.FindControl("lblnodelrefno"); Label nodelemail = (Label)gvrow.FindControl("nodelemail"); Label lblnodelname = (Label)gvrow.FindControl("lblnodelname"); string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/GeneratePassword.html"))) { body = reader.ReadToEnd(); } body = body.Replace("{UserName}", lblnodelname.Text); body = body.Replace("{refno}", HttpUtility.UrlEncode(objEnc.EncryptData(lblnodelrefno.Text))); body = body.Replace("{curid}", Resturl(56)); SendMail s; s = new SendMail(); s.CreateMail("*****@*****.**", nodelemail.Text, "Create Password Email", body); s.sendMail(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "SuccessfullPop('Create password email send successfully.')", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('Login detail not send. Some error occured.')", true); } } }
public void SendEmailCodeNodalOfficer(string id) { try { string body; using (StreamReader reader = new StreamReader(Server.MapPath("~/emailPage/NodalInfoDetailCart.html"))) { body = reader.ReadToEnd(); } DataTable dtMail = Lo.RetriveMailCart(id); StringBuilder html = new StringBuilder(); html.Append("<table border = '1'>"); html.Append("<tr>"); foreach (DataColumn column in dtMail.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); { for (int m = 0; dtMail.Rows.Count > m; m++) { html.Append("<tr>"); foreach (DataColumn column in dtMail.Columns) { html.Append("<td>"); html.Append(dtMail.Rows[m][column.ColumnName]); html.Append("</td>"); } html.Append("</tr>"); } } html.Append("</table>"); body = body.Replace("{dt}", html.ToString()); body = body.Replace("{name}", txtname.Text.Trim()); body = body.Replace("{compname}", txtcompname.Text.Trim()); body = body.Replace("{address}", txtofficeaddress.Text.Trim()); body = body.Replace("{email}", txtemail.Text.Trim()); body = body.Replace("{phone}", txtphone.Text.Trim()); SendMail s; s = new SendMail(); for (int n = 0; dtMail.Rows.Count > n; n++) { if (dtMail.Rows[n]["NodalOfficerEmail"].ToString() != "") { s.CreateMail("*****@*****.**", dtMail.Rows[n]["NodalOfficerEmail"].ToString(), "Make in India opportunities Information", body); } else { DataTable DtGetCompIdbyNodal = Lo.RetriveGridViewCompany(dtMail.Rows[n]["ProductRefNo"].ToString(), "", "", "GetIdComporNodal"); if (DtGetCompIdbyNodal.Rows.Count > 0) { s.CreateMail("*****@*****.**", DtGetCompIdbyNodal.Rows[0]["NodalOfficerEmail"].ToString(), "Make in India opportunities Information", body); } else { s.CreateMail("*****@*****.**", "*****@*****.**", "Make in India opportunities Information", body); } } } s.sendMail(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "ErrorMssgPopup('" + ex.Message + "')", true); } }