/** * @param $host * @return bool|array */ public function query($host) { if (getmxrr($host, $mx_records, $mx_weight) === false) { $this->logger->debug("no MX records for host <{$host}> found"); return false; } $this->logger->debug("found " . count($mx_records) . " MX records for host <{$host}>"); // TODO: sort by weight return $mx_records; }
/** * @param string $url * @param integer $port * @return bool */ protected function canConnect($url, $port) { $this->logger->debug("attempting to connect to <{$url}> on port <{$port}>"); $fp = fsockopen($url, $port, $error, $errorstr, self::CONNECTION_TIMEOUT); if (is_resource($fp)) { fclose($fp); $this->logger->debug("connection to <{$url}> on port <{$port}> established"); return true; } $this->logger->debug("cannot connect to <{$url}> on port <{$port}>"); return false; }
/** * @NoAdminRequired * * @param int $accountId * @param string $folderId * @param string $id * @return JSONResponse */ public function destroy($accountId, $folderId, $id) { $this->logger->debug("deleting message <{$id}> of folder <{$folderId}>, account <{$accountId}>"); try { $account = $this->getAccount($accountId); $account->deleteMessage(base64_decode($folderId), $id); return new JSONResponse(); } catch (DoesNotExistException $e) { $this->logger->error("could not delete message <{$id}> of folder <{$folderId}>, " . "account <{$accountId}> because it does not exist"); return new JSONResponse([], 404); } }