This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Friday, May 16, 2008

How to send Email in ASP.Net 2.0

How to send Email in ASP.Net 2.0
have changed from ASP.Net1.1 and ASP.Net 2.0, for email sending. The namespace has changed from System.Web.Mail to System.Net.Mail. and to get the email working, there are two classes that need to be addressed:

  • MailMessage()
  • SmtpClient()
To use these, it will look something like this:
using System.Net.Mail;
SmtpClient MailClient=new SmtpClient("127.0.0.1");
MailMessage Msg = new MailMessage(SenderAddress,ReceiptAddress);
Msg.Subject = "YourSubject";
string Message="";
Message="";
Message += "";
Message += "";
Message += "
Thank you for registerting in allabout-dotnet.blogspot.com
Your EMail:" + txtEMail.Text.ToString() + "
Your Password:" + TxtPassword.Text.ToString() + "
";
Msg.Body = Message;
Msg.IsBodyHtml = true;
try
{
MailClient.Send(Msg);
}
catch (System.Exception ex)
{
Response.Write(ex.toString());
}

As said earlier, several things have changed, and, it's not quite as easy as it was with ASP.Net version 1.1, but still, emailing in ASP.Net is not complicated at all.

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger