SMTP sent to email
<pre><code>using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class HTML_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("mmuqaddis@yahoo.com");//email from
        msg.To.Add(new MailAddress("mmuqaddis@yahoo.com"));//email to
        msg.Subject = "message subject";//subject
        msg.Body = "message body";//message

        SmtpClient smtp = new SmtpClient("smtp.yahoo.com");//smtp host
        smtp.Send(msg);
        //Send message to email

    }
}
</code></pre>

<blockquote>
  <p>Server Error in '/LoginRegister' Application.</p>
  
  <p>The operation has timed out.</p>
  
  <p>Description: An unhandled exception occurred during the execution of
  the current web request. Please review the stack trace for more
  information about the error and where it originated in the code. </p>
  
  <p>Exception Details: System.Net.Mail.SmtpException: The operation has
  timed out.</p>
  
  <p>Source Error: </p>
  
  <p>Line 26:  Line 27:         SmtpClient smtp = new
  SmtpClient("smtp.yahoo.com"); Line 28:         smtp.Send(msg); Line
  29:  Line 30:     }</p>
  
  <p>Source File: c:\Users\apr12mpsip\Documents\Visual Studio
  2012\WebSites\LoginRegister\HTML\ForgotPassword.aspx.cs    Line: 28 </p>
  
  <p>Stack Trace: </p>
  
  <p>[SmtpException: The operation has timed out.]<br>
  System.Net.Mail.SmtpClient.Send(MailMessage message) +1798<br>
  HTML_Default.btnSubmit_Click(Object sender, EventArgs e) in
  c:\Users\apr12mpsip\Documents\Visual Studio
  2012\WebSites\LoginRegister\HTML\ForgotPassword.aspx.cs:28<br>
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9553594<br>
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String
  eventArgument) +103<br>
  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
  eventArgument) +10<br>
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
  sourceControl, String eventArgument) +13<br>
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
  +35    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  +1724</p>
</blockquote>
