Sending Email Using ASP.Net 2.0

Sending Email Using ASP.Net 2.0
Add Belowe Name Space to Access All Class and Methods Which Are Needed for Sending Mail.
using System.Net.Mail;
Write Down Following Code on Button Click
MailMessage msg = new MailMessage();
msg.From = new MailAddress("");
msg.To.Add(new MailAddress(""));
msg.Subject = "Message Subject";
msg.Body = "Mail body content";
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
SmtpClient c = new SmtpClient("domain smtp server");
c.Credentials = new System.Net.NetworkCredential("", "userpassword");
While Developing and Testing this Module there are Verious Problem Exisits it's mainly Security and SMTP Configuration
Related if you Found any Problem then let me know that Once.

Prev Post                                                      All Post                                                           Next Post

Posted in |


  1. sreenath Says:

    Using CDOSYS the mail sending is very simple

    Add a reference of the Microsoft CDO for windows 2000 library in the solution

    right click in the solution bin folder-->Add reference -->Select COM tab --> and click on Microsoft CDO for windows 2000 library

    private void SendEmail()
    Message msg = new MessageClass();
    msg.From = "";

    msg.To = "";
    msg.Subject = "Your Subject";
    msg.TextBody = "Your Message Body"
    catch (Exception ex)
    throw ex;


  2. Anonymous Says:

    Nice Coding Suggestion SREENATH

    but i am thinking in 2.0 Sending mail using System.Net.mail is efficient.

    Are you use this code in 1.1 ?

  3. Anonymous Says:

    to Access Messageclass include foloowing namespace.

    using CDO;

Post a Comment