protected void Button2_Click(object sender, EventArgs e) { Hashtable data = new Hashtable(); data.Add("ticket_id", txtticket_id.Text); data.Add("taskdesc", txtxtaskdesc.Text); data.Add("ticket_status", cbstatus.SelectedItem.Text); data.Add("workdonetechnician",txtworkdonetech.Text); data.Add("others", txtothers.Text); data.Add("dorepair", txtdorepair.Text); data.Add("assetid", txtassetid.Text); bll clupd = new bll(); clupd.compupd(data); int id = Convert.ToInt32(txtticket_id.Text); if (cbstatus.SelectedValue.ToString() == "Close") { Hashtable feedmail = new Hashtable(); bll fm = new bll(); feedmail = fm.feedbackmail(id); System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage(); mail.From = "*****@*****.**"; mail.To = feedmail["emailid"].ToString(); mail.Subject = "Feedback"; mail.BodyFormat = System.Web.Mail.MailFormat.Html; mail.Body = "<html><body><br><br>Dear Client,<br><br>IFLCM would like to invite you to participate in a survey to tell us about your experiences with IFLCM.<br><br> The survey will take about 5 minutes to complete and can be accessed by clicking on the link below.<br><br>" + feedmail["body"].ToString() + " <br><br>Your feedback is very important, as the results of this survey will help us develop and offer better services to you, and other clients in the future. <br><br>Thank you in advance for your participation! <br><br> Please note: all of your answers are completely anonymous and confidential.<br><br> <br> Sincerely,<br> IFLCM Team </body></html>"; System.Web.Mail.SmtpMail.SmtpServer = "smtp.gmail.com"; //System.Web.Mail.SmtpMail.SmtpServer = "smtp.mail.yahoo.com"; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "*****@*****.**"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "cmsiflcm"); // - smtp.gmail.com use port 465 or 587 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); //mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true"); try { //System.Web.Mail.Send(mail); System.Web.Mail.SmtpMail.Send(mail); // Response.Write("Mail is Sent..!!"); } catch (Exception ex) { //return ex.Message; // Response.Write("Error - " + ex.Message); } } Label23.Text = "Successfully Updated"; }