Beispiel #1
0
 function mxconnect($host = null, $port = null, $tout = null, $name = null, $context = null, $debug = null)
 {
     global $_RESULT;
     $_RESULT = array();
     if (!FUNC4::is_debug($debug)) {
         $debug = debug_backtrace();
     }
     if (!is_string($host)) {
         FUNC4::trace($debug, 'invalid host type');
     } else {
         $host = strtolower(trim($host));
         if (!($host != '' && FUNC4::is_hostname($host, true, $debug))) {
             FUNC4::trace($debug, 'invalid host value');
         }
     }
     $res = FUNC4::is_win() ? FUNC4::getmxrr_win($host, $arr, $debug) : getmxrr($host, $arr);
     $con = false;
     if ($res) {
         foreach ($arr as $mx) {
             if ($con = SMTP4::connect($mx, $port, null, null, null, $tout, $name, $context, null, $debug)) {
                 break;
             }
         }
     }
     if (!$con) {
         $con = SMTP4::connect($host, $port, null, null, null, $tout, $name, $context, null, $debug);
     }
     return $con;
 }
Beispiel #2
0
 function is_mail($addr = null, $vermx = false, $debug = null)
 {
     if (!FUNC4::is_debug($debug)) {
         $debug = debug_backtrace();
     }
     $err = array();
     if (!is_string($addr)) {
         $err[] = 'invalid address type';
     }
     if (!is_bool($vermx)) {
         $err[] = 'invalid MX type';
     }
     if (count($err) > 0) {
         FUNC4::trace($debug, implode(', ', $err));
     } else {
         $ret = count($exp = explode('@', $addr)) === 2 && $exp[0] != '' && $exp[1] != '' && FUNC4::is_alpha($exp[0], true, '_-.') && (FUNC4::is_hostname($exp[1]) || FUNC4::is_ipv4($exp[1]));
         if ($ret && $vermx) {
             if (FUNC4::is_ipv4($exp[1])) {
                 $ret = false;
             } else {
                 $ret = FUNC4::is_win() ? FUNC4::getmxrr_win($exp[1], $mxh, $debug) : getmxrr($exp[1], $mxh);
             }
         }
         return $ret;
     }
 }