Send out MailMessage
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Mail" %> <script runat="server"> void Button1_Click(Object sender, EventArgs e) { MailMessage EMail = new MailMessage(); EMail.To = "d@s.com"; EMail.From = "r@a.com"; EMail.Cc = "s@a.com"; EMail.Subject = "Test Email"; EMail.Body = "Here is the body of our email"; SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(EMail); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); } } </script> <html> <head> </head> <body> <form runat="server"> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Send Email" Width="103px"></asp:Button> <!-- Insert content here --> </form> </body> </html>