title: Email sending code working on localhost but not on server
body: <p>I have written an email sending code using c#. I used GoDaddy's server for my website. It is working on localhost (VS 2013), But when deployed the same code on the server it gives the following error:</p>
  
  <hr>
  
  <blockquote>
    <p><strong>Server Error in '/' Application.</strong></p>
    
    <p>A connection attempt failed because the connected party did not
    properly respond after a period of time, or established connection
    failed because connected host has failed to respond
    [2607:f8b0:400e:c05::6c]:25</p>
  </blockquote>
  
  <p><strong>Description:</strong> 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><strong>Exception Details:</strong> System.Net.Sockets.SocketException: A connection attempt fail because the connected party did not properly respond after a period of time, or establish connection fail because connected host has failed to respond [2607:f8b0:400e:c05::6c]:25 </p>
  
  <p>Stack Trace: </p>
  
  <blockquote>
    <p>[SocketException (0x274c): A connection attempt failed because the
    connected party did not properly respond after a period of time, or
    established connection failed t
    SMS.Portal.SendSMS.btnSubmit_Click(Object sender, EventArgs e) in
    d:\Paul\ProximityMarketer\smsproximitysource\source\Portal\SendSMS.aspx.cs:30
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9633514
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    eventArgument) +103
    System.Web.UI.WebControls.Button.System.Web...IPostBackEventHandler.RaisePostBackEvent(String
    eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +1724</p>
  </blockquote>
  
  <p>Version Information: Microsoft .NET Framework version:4.0.30319; ASP.NET version:4.0.30319.34280 </p>
  
  <hr>
  
  <p>Code is given below:</p>
  
  <pre><code>SmtpClient smtpclient = new SmtpClient();
  smtpclient.Host = "smtp.gmail.com";
  smtpclient.Port = 25;
  smtpclient.Credentials = new NetworkCredential("xxxxx@gmail.com", "Password");
  smtpclient.EnableSsl = true;
  MailMessage objmsg = new MailMessage();
  objmsg.From = new MailAddress("xxxxx@gmail.com");
  objmsg.To.Add(email);
  objmsg.Subject = "testing";
  objmsg.Body = myString.ToString();
  objmsg.IsBodyHtml = true;
  smtpclient.Send(objmsg);
  </code></pre>