Pre-RFC discussion about adding a DNS function for Null MX handling

From: Date: Wed, 13 May 2026 01:47:23 +0000
Subject: Pre-RFC discussion about adding a DNS function for Null MX handling
Groups: php.internals 
Request: Send a blank email to internals+get-130860@lists.php.net to get a copy of this message
Hi internals, I would like to gather feedback before drafting an RFC for a small addition to PHP's DNS functions: dns_check_mx(string $hostname): bool The function would check whether a hostname has at least one non-null MX record. Today, checkdnsrr($domain, "MX") correctly returns true for a domain publishing a Null MX record: example.com. IN MX 0 . This is correct, since an MX record exists. However, RFC 7505 ( https://www.rfc-editor.org/rfc/rfc7505.html) defines this as an explicit signal that the domain does not accept email. I am not proposing any change to checkdnsrr(). It should remain a low-level DNS record existence check. Proposed behavior: - false when there are no MX records; - false when all MX records are Null MX records; - true when at least one MX record has an exchange target other than ".". This would not validate email deliverability or perform SMTP-level checks. It would only provide a DNS-level distinction between "has an MX record" and "has a non-null MX record". If there is interest in this direction, I am willing to work on the RFC and implementation. I would appreciate feedback on the scope, naming, and edge cases before preparing an RFC. Regards, Samuel Fontebasso

« previous php.internals (#130860) next »