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

Here is a small script that actually send emails using asp.net system.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"));

SmtpMail.Send(msgMail);

Response.Write("Email has been sent");

%>

 

Enjoy ASP.NET coding !!!

 

Read More: ASP - Simple Login Script

 

                    ASP.Net - Code For File Download

 

                    What is Fantastico and how is it useful?

 

                    Basic ColdFusion Html File

Hosting Companies insights

2082 Web Hosting Reviews A trusted source of genuine reviews. Learn Reviews
2606 Web Hosting Companies Ever-growing pool of web hosting providers. Browse Providers
2940 Web Hosting Coupons Exciting web hosting deals available here Browse Coupons
Share
Tweet
Share
Share
Share
Email