Sending Email with ASP.NET

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");
%>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Sending Email with CDOSYS

This article applies to Windows hosting accounts only. Sending e-mail with CDOSYS CDO...

Sending Email with J-Mail

This article applies to Windows hosting accounts only. JMail is an ASP component which can be...