Send e-mail using Asp.Net 1.1


The following code example can be used to send email using Asp.Net in 1.1 version.

First import Web.Mail namespace.
using System.Web.Mail;

Now add this code to your button click event:

MailMessage mail = new MailMessage();

String msgText = string.Empty;
msgText = “Message here, you can also use Html tags for Rich Text Formatting.<br>Hi.”;

mail.To = “you@yourdomain.com”;
mail.CC = “anyEmailAddress, its optional”;
mail.Bcc = “anyEmailAddress, its optional”;
mail.From = @”””Ajay”” <info@yourdomain.com>”;
//mail.From = “info@yourdomain.com”;
mail.Subject = “Mail test”;
mail.BodyFormat = MailFormat.Html;
mail.Body = msgText;
SmtpMail.SmtpServer = “mail.yourdomain.com”;

SmtpMail.Send(mail);

Note:

The email address specified in the “FROM” field must be valid and it need to be of your domain.
In the SmtpServer the domain name must be same as of your domain on which website is hosted.

Advertisements

About dotnetcoderoom

Working as an Onsite coordinator in USA. Handling UAT, CR (Change Requests), Product Support/Development, Build Management. Supervise and assist in live product implementation (at client side) and training. Providing technical direction for the development, design, and system integration. Closely monitoring and working with offshore team for Enhancements, Bug Fixing, Enforce coding standards, perform code reviews and mentors junior developers. Proven track of timely delivery of enterprise level web based applications. Skilled in a variety of software languages, tools, and methodologies, with a special expertise in Microsoft .NET technologies. MCTS .Net 4.0 Web applications MCTS .Net 2.0 Web applications GNIIT, MCA, B.Com Specialties 8+ Years of experience in .NET Technologies. Expertise in .NET, ASP.NET, MVC, C#, VB.NET, WCF, Web Services, MS SQL, JQuery. Excellent R&D and troubleshooting skills. Extensive knowledge in E-Commerce and Healthcare domain. View all posts by dotnetcoderoom

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: