title: send email asp.net c#
body: <p>Is it possible to send email from my computer(localhost) using asp.net project in C#?
  Finally I am going to upload my project into webserver but I want to test it before uploading. </p>
  
  <p>I've found ready source codes and tried run them in localhost, but neither of them work succesfully.
  For example this code:</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.Mail;
  
      namespace sendEmail
      {
          public partial class _default : System.Web.UI.Page
          {
              protected void Page_Load(object sender, EventArgs e)
              {
  
              }
              protected void Btn_SendMail_Click(object sender, EventArgs e)
              {
                  MailMessage mailObj = new MailMessage(
                      txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
                  SmtpClient SMTPServer = new SmtpClient("localhost");
                  try
                  {
                      SMTPServer.Send(mailObj);
                  }
                  catch (Exception ex)
                  {
                      Label1.Text = ex.ToString();
                  }
              }
          }
      }
  </code></pre>
  
  <p>So how to send email using asp.net C#? Should I setup some server configurations?</p>