title: C# smtp.google.com could not be resolved
body: <p>Following code used to work but suddenly refuses to work.</p>
  
  <pre><code>private static void SendMail()
  {
      try
      {
          var mail = new MailMessage();
          var smtpServer = new SmtpClient("smtp.google.com", 587);
          mail.From = new MailAddress("catthoor.jc@gmail.com", "Jasper.Kattoor");
          mail.To.Add("YYYY");
          mail.Subject = "sup";
          mail.Body = "sup";
          smtpServer.Credentials = new NetworkCredential("catthoor.jc@gmail.com", "XXXX");
          smtpServer.EnableSsl = true;
          smtpServer.Send(mail);
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex);
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>I receive the following error:</p>
  
  <blockquote>
    <p>System.Net.Mail.SmtpException: Failure sending mail. --->
    System.Net.WebException: The remote name could not be resolved:
    'smtp.google.com'</p>
  </blockquote>
  
  <p>I've also tried using hotmail instead of gmail, same error.
  I can still send mails manually though.
  Why would this error suddenly occur? Yesterday there were no problems with this.</p>