protected void SendMail() { string TotalMail; foreach (GridViewRow gvr in YourGridView.Rows) { CheckBox chkMail = (CheckBox)gvr.Cells[0].FindControl("chkMail"); Label lblMailId = (Label)gvr.Cells[1].FindControl("lblMailId "); if(chkMail.Checked == true) { TotalMail = TotalMail + lblColumn1.Text.ToString(); } } objEmail = new MailMessage(); objEmail.To = TotalMail; objEmail.From = txtFrom.Text; objEmail.Subject = "Test Email"; objEmail.Body = txtName.Text + ", " + txtComments.Text; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)