title: sending email from godaddy account using C#
body: <p>I'm trying to send and email from a C# application running on the desktop. Does anyone see any particular reason why this would error and time out, as a result never sending the email. I've looked around online and haven't been able to find a solution which actually works when doing this.</p>
  
  <p>I do however had a php mail which runs directly off the godaddy server which sends emails. So i know the server isn't the problem. The php version doesn't require a password.</p>
  
  <p>Here is the code.</p>
  
  <pre><code>SmtpClient ss = new SmtpClient();
              try
              {
                  ss.Host = "relay-hosting.secureserver.net";
                  ss.Port = 25;
                  ss.Timeout = 10000;
                  ss.DeliveryMethod = SmtpDeliveryMethod.Network;
                  ss.UseDefaultCredentials = false;
                  ss.Credentials = new NetworkCredential("daemon@johntest.com", "####");
  
                  MailMessage mailMsg = new MailMessage("daemon@johntest.com", "testingJohn@gmail.com", "testing email", "my body");
                  mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                  ss.Send(mailMsg);
  
                  Console.WriteLine("Sent email");
                  Console.ReadKey();
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.Message);
                  Console.ReadKey();
              }
  </code></pre>
  
  <blockquote>
    <p>Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
    Exception thrown: 'System.Net.WebException' in System.dll Exception
    thrown: 'System.Net.WebException' in System.dll Exception thrown:
    'System.Net.WebException' in System.dll Exception thrown:
    'System.Net.Mail.SmtpException' in System.dll Exception thrown:
    'System.InvalidOperationException' in mscorlib.dll</p>
  </blockquote>