try { //create the object for the class SmtpClient SmtpClient smtpMailObj = new SmtpClient(); //supply your mail server smtpMailObj.Host = "mailservername"; smtpMailObj.Send(txtFrom.Text,txtTo.Text,txtSubject.Text,txtComment.Text); Response.Write("Your Message has been sent Successfully"); } catch(Exception ee) { Response.Write("Delivery Failed"); }