Introduction
In ASP.NET, sending emails has become
simpler. The classes required to send an email are contained in the
System.Net.Mail. The steps required to send an email from ASP.NET are as follows:
Below is sample code showing how to send email from ASP.Net using C#.
With this code send main from Gmail SMTP server you can also configure your own
SMTP server to change in web config file.
To configure SMTP configuration data for
ASP.NET, you would add the following tags to your web.Config file.
<system.net>
<mailSettings>
<smtp
from="YourEmailid@gmail.com" deliveryMethod="Network">
<network
host="smtp.gmail.com" port="587"
userName="YourEmailid@gmail.com"
password="yourPassword"/>
smtp>
mailSettings>
system.net>