Sending e-mail with ASP.NET
Bookmark this page Print this page
Article Applies To: ASP Plus, ASP Ultimate and Windows Reseller packages

Operating Platform
This article applies to Windows hosting accounts only.

Example
Listed below is a simple example showing how to send email using ASP.NET: -

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%

string strTo = "name@somedomain.co.uk";
string strFrom = "yourname@yourdomain.co.uk";
string strSubject = "Test message";

SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(strFrom, strTo, strSubject,"Hello, this is a test message.");

Response.Write("Email successfully sent");
%>

Last Modified: 16/03/2011
© 2004 - 2014 Storm Internet Ltd