Esempio n. 1
0
 public static function mxconnect($host = null, $port = null, $tout = null, $name = null, $context = null, $debug = null)
 {
     global $_RESULT;
     $_RESULT = array();
     if (!FUNC5::is_debug($debug)) {
         $debug = debug_backtrace();
     }
     if (!is_string($host)) {
         FUNC5::trace($debug, 'invalid host type');
     } else {
         $host = strtolower(trim($host));
         if (!($host != '' && FUNC5::is_hostname($host, true, $debug))) {
             FUNC5::trace($debug, 'invalid host value');
         }
     }
     $res = FUNC5::is_win() ? FUNC5::getmxrr_win($host, $arr, $debug) : getmxrr($host, $arr);
     $con = false;
     if ($res) {
         foreach ($arr as $mx) {
             if ($con = self::connect($mx, $port, null, null, null, $tout, $name, $context, $debug)) {
                 break;
             }
         }
     }
     if (!$con) {
         $con = self::connect($host, $port, null, null, null, $tout, $name, $context, $debug);
     }
     return $con;
 }