/** * This Ajax function retrieves whether a TCP port is open or not. * This is called by both the Wizard and Port Test */ function runSmtpTest() { $hostname = trim(PostmanUtils::getRequestParameter('hostname')); $port = intval(PostmanUtils::getRequestParameter('port')); $transport = trim(PostmanUtils::getRequestParameter('transport')); $timeout = PostmanUtils::getRequestParameter('timeout'); $this->logger->trace($timeout); $portTest = new PostmanPortTest($hostname, $port); if (isset($timeout)) { $portTest->setConnectionTimeout(intval($timeout)); $portTest->setReadTimeout(intval($timeout)); } if ($port != 443) { $this->logger->debug(sprintf('testing SMTP socket %s:%s (%s)', $hostname, $port, $transport)); $success = $portTest->testSmtpPorts(); } else { $this->logger->debug(sprintf('testing HTTPS socket %s:%s (%s)', $hostname, $port, $transport)); $success = $portTest->testHttpPorts(); } $this->buildResponse($hostname, $port, $portTest, $success, $transport); }
/** * This Ajax function retrieves whether a TCP port is open or not */ function runSmtpTest() { $hostname = trim($this->getRequestParameter('hostname')); $port = intval($this->getRequestParameter('port')); $timeout = $this->getRequestParameter('timeout'); $this->logger->trace($timeout); $portTest = new PostmanPortTest($hostname, $port); if (isset($timeout)) { $portTest->setConnectionTimeout(intval($timeout)); $portTest->setReadTimeout(intval($timeout)); } if ($port != 443) { $this->logger->debug('testing SMTP port: hostname ' . $hostname . ' port ' . $port); $success = $portTest->testSmtpPorts(); } else { $this->logger->debug('testing HTTPS port: hostname ' . $hostname . ' port ' . $port); $success = $portTest->testHttpPorts(); } $this->buildResponse($hostname, $port, $portTest, $success); }