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; }
function connect($host = null, $port = null, $user = null, $pass = null, $vssl = null, $tout = null, $name = null, $context = null, $debug = null) { global $_RESULT; $_RESULT = array(); if (!FUNC4::is_debug($debug)) { $debug = debug_backtrace(); } if ($host == null) { $host = $this->Host; } if ($port == null) { $port = $this->Port; } if ($user == null) { $user = $this->User; } if ($pass == null) { $pass = $this->Pass; } if ($vssl == null) { $vssl = $this->Vssl; } if ($tout == null) { $tout = $this->Tout; } if ($name == null) { $name = $this->Name; } if ($context == null) { $context = $this->Context; } if ($ret = SMTP4::connect($host, $port, $user, $pass, $vssl, $tout, $name, $context, $debug)) { $this->_conns[] = $ret; } return $this->_result($_RESULT, $ret); }