address !== '' && ($this->profile !== 'archivecow' || $this->signingKey !== ''); } /** Next hop for Postfix: [host]:port, else the domain of the address (MX lookup), with the port when not 25 */ public function nexthop(): string { if ($this->host !== '') { $host = filter_var($this->host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ? 'ipv6:' . $this->host : $this->host; return '[' . $host . ']:' . $this->port; } $domain = substr($this->address, (int)strrpos($this->address, '@') + 1); return ($this->port === 25) ? $domain : $domain . ':' . $this->port; } /** API representation (GET archive/settings), without secrets */ public function toArray(): array { return [ 'enabled' => (int)$this->enabled, 'address' => $this->address, 'host' => $this->host, 'port' => $this->port, 'tls' => $this->tls, 'username' => $this->username, 'has_password' => (int)($this->password !== ''), 'profile' => $this->profile, 'has_signing_secret' => (int)($this->signingKey !== ''), 'header_from' => $this->headerFrom, 'header_rcpt' => $this->headerRcpt, ]; } }