title: MailMessage is not working even with system.net.mail reference
body: <p>MailMessage is not working i don't know what I'm missing. Pls correct my program if there is missing codes or did i use wrong namespace?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Net;
  using System.Net.Mail;
  using System.Web.Mail;
  using System.Data.SqlClient;
  using System.Data;
  
  protected void btnsend_Click(object sender, EventArgs e)
  {
     try
     {
        SmtpClient smtp=new SmtpClient("smtp.gmail.com",587);
        smtp.EnableSsl = true;
        smtp.UseDefaultCredentials = false;
        smtp.Credentials=new NetworkCredential(txtemail.Text,txtpassword.Text);
        MailMessage mail = new MailMessage(txtemail.Text, ddlemail.Text, txtsubject.Text, txtbody.Text);
        smtp.Send(mail);
     }
     catch (Exception ex)
     {
        Console.WriteLine("{0} Exception caught.", ex);
     }
  }
  </code></pre>