C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Sending Email in ASP.NET 2.0


Posted Date: 21 Jun 2008    Resource Type: Articles    Category: Web Applications

Posted By: pradeep       Member Level: Silver
Rating:     Points: 10



things 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:

1) MailMessage()
2) SmtpClient()

To use these, it will look something like this:

using System.Net.Mail;//namespace


SmtpClient MailClient=new SmtpClient("127.0.0.1");
MailMessage Msg = new MailMessage(SenderAddress,ReceiptAddress);
Msg.Subject = "YourSubject";
string Message="";
Message="Thank you for registerting Jaadoo.net
";
Message += " Your EMail:" + txtEMail.Text.ToString() + "
";
Message += " Your Password:" + TxtPassword.Text.ToString() + "
";
Message += " ";
Msg.Body = Message;
Msg.IsBodyHtml = true;
try
{
MailClient.Send(Msg);
}
catch (System.Exception ex)
{
Response.Write(ex.toString());
}




Responses

Author: Satyanarayan SushilKumar Bajoria    22 Jun 2008Member Level: Gold   Points : 1
Hi,
Nice piece of code to explain how to send email in ASP.Net.
You explain in a much simpler way.
Keep posting such useful article.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Creating Thumbnail of images in ASP.NET
Previous Resource: News section in asp.net
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

fax server

Contact Us    Privacy Policy    Terms Of Use