How to mail using ASP.NET?

You can create a mail form in asp.net.

1. Create a html form which will get the values from the user.

For Example:
<form method="POST" action="test.aspx">

To <input type="text" name="To">

From <input type="text" name="From">

Subject <input type="text" name="Subject">

Body <textarea name="Body" rows="5" cols="20" wrap="physical">

2. Add the following code into the file test.aspx.

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
<%
string strTo = "test@test.com";
string strFrom = "test@dnswind.com";
string strSubject = "Hi Test";

SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(strFrom, strTo, strSubject, "A real nice body text here");

Response.Write("Email was queued to disk");
%>

Was this answer helpful?

 Print this Article

Also Read

How to redirect using Plesk ControlPanel?

Redirect Using Plesk Step 1:Login to plesk control panel. Step 2:Select Mail. Step 3:Select on...

How to mail using ASP?

You can create a mail form in asp. 1. Create a html form which will get the values from the...

How to upload files in windows server

You can upload the files using either FTP softwares or by File Manager in cpanel. Option 1: For...

How to setup a access database in plesk?

Access database (mdb) in Plesk - How to setup a access database in plesk Upload the mdb file in...

How do i disable directory listing from Plesk?

Disable Directory Listing Step 1:Login to Plesk Step 2:Goto Domains -> Domain Name -> Web...