Sending Email with ASP.NET
Asp.net provide a simple way to sending mail. You can implement mail code in you application following type.
using System.Web.Mail;
public partial class contact_us : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
sendmailfunc();
}
public void sendmailfunc()
{
string text = “”;
text = text + “Hello ! this is a test mail
System.Web.Mail.MailMessage objMail = new System.Web.Mail.MailMessage();
objMail.To = “text@testmail.com”;
objMail.Bcc = “dinesh2k20@gmail.com”;
objMail.Subject = “Website Enquiry:”;
objMail.Body = text;
objMail.BodyFormat = MailFormat.Html;
objMail.From = ” text@testmail.com “;
try
{
SmtpMail.Send(objMail);
}
catch
{
}
}
}
“;