Description
This is a common function Required for every website. For this you have to add
System.Web.Mail
namespace
The System.Web.Mail namespace contains classes that enable you to
construct and send messages using the CDOSYS (Collaboration Data Objects for
Windows 2000) message component. The mail message is delivered either through
the SMTP mail service built into Microsoft Windows 2000 or through an arbitrary
SMTP server. The classes in this namespace can be used from ASP.NET or from any
managed application.
For more info about System.Web.Mail
click here.
Steps
-Create a website and design the Form like below screen
or copy this code in source code and paste within < form > tag
<table align="center">
<tr><td>
<asp:Label ID="Label6" runat="server" Text="From"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtFrom" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="Password"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="To : "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtTo" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Subject :"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSub" runat="server" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" Text="Message :"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtMsg" runat="server" Height="117px" TextMode="MultiLine" Width="339px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send Mail"
OnClientClick="return validate();" Width="123px" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
now go to code view and write below code
using System;


Dhanik SahniPosted Jul 17, 2013, 10:09 AM
Got smtp exception
Dhanik SahniPosted Jul 17, 2013, 10:08 AM
I tried it but not able to get email. May be issue at my end. Blog is informativ
Rohatash KumarPosted May 30, 2013, 5:05 AM
Nice%20blog.