API / Minn\Mail / HostEntry

HostEntry final readonly class

Minn\Mail\HostEntry · public/minn/src/Minn/Mail/HostEntry.php · 66 lines

One entry of a mailer's Host setting ("host", "host:port", "ssl://host:465", "tls://host"; entries are separated by semicolons): the security prefix, the host and the port. Only ssl:// and tls:// are prefixes; anything else stays part of the host and fails the host check.

Constants and properties

propreadonly string $prefix

Promoted from the constructor.

propreadonly string $host

Promoted from the constructor.

propreadonly ?int $port

Promoted from the constructor.

Public

new__construct(string $prefix, string $host, ?int $port)#
staticparseAll(string $hosts): array#

The entries of a Host setting, null where one cannot be read.

@return list<array{0: string, 1: self|null}> the trimmed entry text and its reading
methodportOr(int $default): int#

The port to connect on: the entry's own when it is one (1 to 65535), else the mailer's Port (probe db-mail-rewrite-doubts).

methodtakesOfferedTls(): bool#

Whether a server's STARTTLS offer is taken on its own: never for localhost, nor without OpenSSL.

staticserverName(string $configured, ?string $serverName): string#

The name the mailer gives itself (serverHostname): the configured Hostname, else the request's SERVER_NAME when one is set (even empty), else the machine's; one that is not a valid host is localhost.localdomain.

staticvalidHost(mixed $host): bool#

Whether a host name, IPv4 address or bracketed IPv6 address is well formed.