/** * * @param unknown $host * @param unknown $port */ function test($host, $port, $tests, $expectedResult) { $p = new PostmanPortTest($host, $port); $success = false; if ($tests & SMTP) { $success = $p->testSmtpPorts(TIMEOUT, TIMEOUT); } elseif ($tests & SMTPS) { $success = $p->testSmtpsPorts(TIMEOUT, TIMEOUT); } if ($tests & STARTTLS) { $success &= $p->startTls; } if ($tests & CRAMMD5) { $success &= $p->authCrammd5; } if ($tests & XOAUTH) { $success &= $p->authXoauth; } if ($tests & LOGIN) { $success &= $p->authLogin; } if ($tests & PLAIN) { $success &= $p->authPlain; } $displaySuccess = 'fail'; if ($success == $expectedResult) { $displaySuccess = 'pass'; } print "{$displaySuccess}: {$host}:{$port}\n"; }
/** * This Ajax function retrieves whether a TCP port is open or not */ function runSmtpsTest() { $hostname = trim(PostmanUtils::getRequestParameter('hostname')); $port = intval(PostmanUtils::getRequestParameter('port')); $transport = trim(PostmanUtils::getRequestParameter('transport')); $transportName = trim(PostmanUtils::getRequestParameter('transport_name')); $this->logger->debug(sprintf('testing SMTPS socket %s:%s (%s)', $hostname, $port, $transport)); $portTest = new PostmanPortTest($hostname, $port); $portTest->transportName = $transportName; $success = $portTest->testSmtpsPorts(); $this->buildResponse($hostname, $port, $portTest, $success, $transport); }
/** * This Ajax function retrieves whether a TCP port is open or not */ function runSmtpsTest() { $hostname = trim($this->getRequestParameter('hostname')); $port = intval($this->getRequestParameter('port')); $this->logger->debug('testing SMTPS port: hostname ' . $hostname . ' port ' . $port); $portTest = new PostmanPortTest($hostname, $port); $success = $portTest->testSmtpsPorts(); $this->buildResponse($hostname, $port, $portTest, $success); }