Advertisement
Guest User

Untitled

a guest
Jun 15th, 2017
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. class CCheckMail
  2. {
  3. var $timeout = 10;
  4. var $domain_rules = array ("aol.com", "bigfoot.com", "brain.net.pk", "breathemail.net",
  5. "compuserve.com", "dialnet.co.uk", "glocksoft.com", "home.com",
  6. "msn.com", "rocketmail.com", "uu.net", "yahoo.com", "yahoo.de");
  7.  
  8. function _is_valid_email ($email = "")
  9. { return preg_match('/^[.\w-]+@([\w-]+\.)+[a-zA-Z]{2,6}$/', $email); }
  10.  
  11. function _check_domain_rules ($domain = "")
  12. { return in_array (strtolower ($domain), $this->domain_rules); }
  13.  
  14. function execute ($email = ""){
  15. if (!$this->_is_valid_email ($email)) return false;
  16. $host = substr (strstr ($email, '@'), 1);
  17.  
  18. if ($this->_check_domain_rules ($host)) return false;
  19. $host .= ".";
  20.  
  21. if (getmxrr ($host, $mxhosts[0], $mxhosts[1]) == true) array_multisort ($mxhosts[1], $mxhosts[0]);
  22. else { $mxhosts[0] = $host;
  23. $mxhosts[1] = 10;
  24. }
  25.  
  26. $port = 25;
  27. $localhost = $_SERVER['HTTP_HOST'];
  28. $sender = 'info@' . $localhost;
  29.  
  30. $result = false;
  31. $id = 0;
  32. while (!$result && $id < count ($mxhosts[0]))
  33. { if (function_exists ("fsockopen"))
  34. {
  35. if ($connection = fsockopen ($mxhosts[0][$id], $port, $errno, $error, $this->timeout))
  36. {
  37. fputs ($connection,"HELO $localhost\r\n");
  38. $data = fgets ($connection,1024);
  39. $response = substr ($data,0,1);
  40. if ($response == '2')
  41. {
  42. fputs ($connection,"MAIL FROM:<$sender>\r\n");
  43. $data = fgets($connection,1024);
  44. $response = substr ($data,0,1);
  45. if ($response == '2')
  46. {
  47. fputs ($connection,"RCPT TO:<$email>\r\n");
  48. $data = fgets($connection,1024);
  49. $response = substr ($data,0,1);
  50. if ($response == '2')
  51. {
  52. fputs ($connection,"data\r\n");
  53. $data = fgets($connection,1024);
  54. $response = substr ($data,0,1);
  55. if ($response == '2')
  56. { $result = true; }
  57. }
  58. }
  59. }
  60. fputs ($connection,"QUIT\r\n");
  61. fclose ($connection);
  62. if ($result) return true;
  63. }
  64. }
  65. else break;
  66. $id++;
  67. }
  68. return false;
  69. }
  70. }
  71.  
  72.  
  73.  
  74. $str='*****@*****.**';
  75.  
  76. $alter=new CCheckMail();
  77.  
  78. $alter->execute($str);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement