Merge branch 'master' of http://git.roojs.com:8081/Pman.Core
[Pman.Core] / NotifySmtpCheck.php
index a7bddbb..1de2f94 100644 (file)
@@ -30,12 +30,22 @@ class Pman_Core_NotifySmtpCheck extends Pman
         $ifconfig = file_get_contents("https://ifconfig.co/");
         $dom = new DomDocument('1.0', 'utf-8');
         $dom->loadHTML($ifconfig);
-        print_R($dom);exit;
+        
         $xpath = new DOMXPath($dom);
-        $lists = $xpath->query("code[@class='ip]");
         
+        $element = $xpath->query("//code[@class='ip']");
+        
+        if(!$element->length){
+            return;
+        }
+        
+        $ip = $element->item(0)->nodeValue;
+        
+        $cmd = "host {$ip}";
+        
+        $e = `$cmd`;
         
-        print_R($lists);exit;
+        $helo = substr(array_pop(explode(' ', $e)), 0, -2);
         
         $error = array();
         
@@ -55,7 +65,7 @@ class Pman_Core_NotifySmtpCheck extends Pman
                     )
                 );
                 
-                $smtp = new Net_SMTP($server, $settings['port'], '058177247238.ctinets.com', false, 0, $socket_options);
+                $smtp = new Net_SMTP($server, $settings['port'], $helo, false, 0, $socket_options);
                 
                 $smtp->setDebug(true);