title: How can i check if the smtp server ( as gmail.com / hotmail.fr ) exists?
body: <p>Hello i'm making a program in objective-c for iOS, i would like to only check if the smtp server ( after the @ ) exists by ping it or doing a HTTP request on it and get in return the status ( 200 ).</p>
  
  <p>what i'm doing now it's getting the UITextField.text, cutting it, getting the substring after the @ and doing this... but it is not working...</p>
  
  <pre><code>        NSError *error = nil;
          NSURL *url = [NSURL URLWithString:@"gmail.com"];
          NSURLRequest *request = [NSURLRequest requestWithURL:url];;
          NSURLResponse *response = nil;
          NSData *data=[[NSData alloc] initWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error]];
          NSString* retVal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
          // you can use retVal , ignore if you don't need.
          NSInteger httpStatus = [((NSHTTPURLResponse *)response) statusCode];
          NSLog(@"responsecode: %d", httpStatus);
          // there will be various HTTP response code (status)
          // you might concern with 404
          if(httpStatus == 200)
          {
              NSLog(@"FEELIX CONTENT");
              // do your job
          }
          else
          {
              NSLog(@"FOCK!");
          }
  </code></pre>