On Wed, 13 May 2026 09:50:00 +0000, Christian Schneider
<[email protected]> wrote:

Am I correct that this would be equivalent to the following (example.com <
> http://example.com/> return empty string "" for MX, not a dot ".")?
>         array_any(
>                 dns_get_record($hostname, DNS_MX),
>                 fn($r) => $r["target"]
>         )
>

Hi Chris,

Yes, mostly. The raw PHP value for Null MX may be an empty string, as
you noted, but I would still normalize the target so the check is based
on the DNS-level meaning rather than the exact value returned by
dns_get_record():

        array_any(
            dns_get_record($hostname, DNS_MX),
            fn($r) => rtrim($r["target"] ?? "", ".") !== ""
        )

I agree this can be done in userland. My point is more about API
semantics: PHP already has DNS-level boolean functions, and RFC 7505
makes "has an MX record" and "has a non-null MX record" two different
DNS-level statements.

I also agree this should not become email deliverability validation. It
should stay strictly limited to MX records.

I am trying to understand whether this DNS-level distinction is worth
exposing explicitly in the existing DNS API.

Regards,
Samuel

Reply via email to