public function setLocalDomain(string $domain): self
    {
        if ('' !== $domain && '[' !== $domain[0]) {
            if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                $domain = '['.$domain.']';
            } elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                $domain = '[IPv6:'.$domain.']';
            }
        }

        $this->domain = $domain;

        return $this;
    }
public function setLocalDomain(string $domain): self
    {
        if ('' !== $domain && '[' !== $domain[0]) {
            if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                $domain = '['.$domain.']';
            } elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                $domain = '[IPv6:'.$domain.']';
            }
        }

        $this->domain = $domain;

        return $this;
    }
public function setLocalDomain ( string $ domain ) : self { if ( '' !== $ domain && '[' !== $ domain [ 0 ] ) { if ( filter_var ( $ domain , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { $ domain = '[' . $ domain . ']' ; } elseif ( filter_var ( $ domain , FILTER_VALIDATE_IP , FILTER_FLAG_IPV6 ) ) { $ domain = '[IPv6:' . $ domain . ']' ; } } $ this -> domain = $ domain ; return $ this ; }
Sets the name of the local domain that will be used in HELO.

This should be a fully-qualified domain name and should be truly the domain
you're using.

If your server does not have a domain name, use the IP address. This will
automatically be wrapped in square brackets as described in RFC 5321,
section 4.1.3.
Sets the name of the local domain that will be used in HELO .