public void SendEmail() { try { string from = "*****@*****.**"; //example:- [email protected] MailMessage mail = new MailMessage(); mail.From = new MailAddress(from); mail.To.Add(txtEmail.Text); mail.Subject = "Promotion Mail"; mail.Body = "Your Disclaimer Details Here"; List <MeasurementMaster> objMsr = DesclaimerController.GetMemberByMemberId(MemberId).ToList(); foreach (var item in objMsr) { mail.Body += "\nWEIGHT :- " + item.WEIGHT; mail.Body += "\nHEIGHT :- " + item.HEIGHT; mail.Body += "\nFAT :- " + item.FAT; mail.Body += "\nBMI :- " + item.BMI; } mail.IsBodyHtml = false; SmtpClient smtp = new SmtpClient("intensity.net.in", 587); smtp.EnableSsl = false; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "info@123"); smtp.Send(mail); ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Message has been sent successfully.');", true); } catch (Exception ex) { throw ex; } }
private void BindMeasurement() { try { grdMeasurement.DataSource = DesclaimerController.GetMemberByMemberId(MemberId); grdMeasurement.DataBind(); } catch (Exception ex) { throw ex; } }