C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
Today
    Last 7 Days more...






    Resources » Articles » ASP.NET/Web Applications »

    Sending Email in ASP.NET 2.0


    Posted Date: 21 Jun 2008    Resource Type: Articles    Category: ASP.NET/Web Applications
    Author: kkMember Level: Silver    
    Rating: 1 out of 5Points: 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: Bunty    22 Jun 2008Member Level: Diamond   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  
    Sign In to add 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: ASP.NET/Web Applications


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use