using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Mail; public partial class ContactUs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated == false) { Response.Redirect("~/Account/Login.aspx"); } if (!Page.IsPostBack) { this.lblSuccess.Visible = false; } } protected void btnSend_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { MailMessage myMessage = new MailMessage(); myMessage.Subject = txtboxSubject.Text; myMessage.Body = System.Environment.NewLine + User.Identity.Name + " wrote: " + System.Environment.NewLine + System.Environment.NewLine + txtboxComments.Text; myMessage.From = new MailAddress("bcberp@gmail.com", "BERP Web Administrator"); myMessage.To.Add(new MailAddress("shafin.virji@gmail.com", "Shafin Virji")); myMessage.To.Add(new MailAddress("zkheraj@hotmail.com", "Zul Kheraj")); myMessage.To.Add(new MailAddress("naelak@gmail.com", "Naela Kanji")); myMessage.To.Add(new MailAddress("necqui@hotmail.com", "Necqui Teja")); myMessage.To.Add(new MailAddress("amin_nanji@yahoo.ca", "Amin Nanji")); SmtpClient mySmtpClient = new SmtpClient("smtp.gmail.com", 587); mySmtpClient.Credentials = new System.Net.NetworkCredential("bcberp@gmail.com", "007zamb0n1"); mySmtpClient.EnableSsl = true; mySmtpClient.Send(myMessage); this.tblMessage.Visible = false; this.lblSuccess.Visible = true; } } }