title: How To Test If Hotmail Account Exists?
body: <p>I am trying to test whether my hotmail account exists or not , but the following code did not help me.</p>
  
  <pre><code>public bool IsExists_SMTPMethod(string email)
  {
      string domain = email.Substring(email.IndexOf("@") + 1);
      var servers = _commander.GetMXServers(domain);
  
      Socket socket = null;
  
      foreach (MXServer mxserver in servers)
      {
          IPHostEntry ipHost = Dns.Resolve(mxserver.MailExchanger);
          IPEndPoint endPoint = new IPEndPoint(ipHost.AddressList[0], 25);
          socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
          socket.Connect(endPoint);
  
          if (!CheckResponse(socket, ResponseEnum.ConnectSuccess))
          {
              socket.Close();
          }
          else
          {
              // If connected, send SMTP commands
              {
                  SendData(socket, string.Format("HELO {0}\r\n", "machinename"));
                  if (!CheckResponse(socket, ResponseEnum.GenericSuccess))
                  {
                      socket.Close();
                      continue;
                  }
  
                  SendData(socket, string.Format("MAIL FROM:  &lt;{0}&gt;\r\n", "from@domain.com"));
                  CheckResponse(socket, ResponseEnum.GenericSuccess);
  
                  SendData(socket, string.Format("RCPT TO:  &lt;{0}&gt;\r\n", email));
                  bool result = CheckResponse(socket, ResponseEnum.GenericSuccess);
                  if (!result)
                  {
                      socket.Close();
                      continue;
                  }
                  else
                      return true;
              }
          }
      }
  
      return false;
  }
  </code></pre>