title: Can't send email through SendGrid
body: <p>I'm following the example from <a href="https://sendgrid.com/docs/Code_Examples/csharp.html" rel="nofollow">SendGrid's site</a> and as credentials I'm pasting it what they gave me in the Azure portal. Still, I get this error message. </p>
  
  <blockquote>
    <p>Message = {"Failure sending mail."}<br>
    InnerException = {"Unable to connect to the remote server"}</p>
  </blockquote>
  
  <p>I'm not clear on what to do here, not even how to debug it. I'm running the code from the desktop (before I put it on the site) so I can break-point myself through it. However, to no joy...</p>
  
  <p>Suggestions?</p>
  
  <p>Full code below.</p>
  
  <pre><code>MailMessage mailMsg = new MailMessage();
  mailMsg.To.Add(new MailAddress("to@example.com", "To Name"));
  mailMsg.From = new MailAddress("from@example.com", "From Name");
  mailMsg.Subject = "subject";
  string text = "text body";
  string html = @"&lt;p&gt;html body&lt;/p&gt;";
  mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(
    text, null, MediaTypeNames.Text.Plain));
  mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(
    html, null, MediaTypeNames.Text.Html));
  SmtpClient client = new SmtpClient("smtp.sendgrid.net", Convert.ToInt32(587));
  System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(
    "azure_...@azure.com",
    "LubX........pQc");
  client.Credentials = credentials;
  client.Send(mailMsg);
  </code></pre>