ASP.Net - Send Email Using System.Web.Mail Class

Here is a small script that actually send emails using sytem.webmail class:

<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Mail" %>
MailMessage msgMail = new MailMessage();
msgMail.To = "Recipient Email Address";msgMail.From = "Sender’s email address";
msgMail.Subject = "Subject of an email";
msgMail.BodyFormat = MailFormat.Text;
msgMail.Body = "Body contents";
msgMail.Attachments.Add(new MailAttachment("c:\\shane.xls"));
Response.Write("Email has been sent");

Enjoy ASP.NET coding !!!
Add comment Share
Hosting Companies insights
1404 Web Hosting Reviews A trusted source of genuine reviews. Learn Reviews
2629 Web Hosting Companies Ever-growing pool of web hosting providers. Browse Providers
2211 Web Hosting Coupons Exciting web hosting deals available here Browse Coupons