class MXRecordValidator implements DnsRecordValidatorInterface (View source)

MX Record Validator

Validates MX (Mail Exchange) records according to:

  • RFC 1035: Domain Names - Implementation and Specification (Section 3.3.9)
  • RFC 2181: Clarifications to the DNS Specification (Section 10.3)
  • RFC 7505: A Method for Indicating Mail Box Unavailability ("null MX")

MX records specify the mail servers responsible for accepting email for a domain. RFC 1035 establishes the basic format of MX records with a 16-bit priority value and a domain name. RFC 2181 clarifies that MX targets cannot point to a CNAME. RFC 7505 defines the "null MX" record (priority 0, target ".") to indicate that a domain does not accept email.

Implementation notes:

  • Priority values are from 0 to 65535, with lower values indicating higher priority
  • Standard MX records should point to a valid hostname with A/AAAA records
  • "Null MX" records use "." as the target with priority 0 to indicate no mail service
  • Domains with a null MX record should not have any other MX records
  • MX targets should never point to CNAME records (RFC 2181)

Methods

__construct(ConfigurationManager $config)

No description

validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validate MX record

Details

__construct(ConfigurationManager $config)

No description

Parameters

ConfigurationManager $config

ValidationResult validate(string $content, string $name, mixed $prio, int|string|null $ttl, int $defaultTTL, mixed ...$args)

Validate MX record

Parameters

string $content

The content part of the record

string $name

The name part of the record

mixed $prio

The priority value (if applicable)

int|string|null $ttl

The TTL value

int $defaultTTL

The default TTL to use if not specified

mixed ...$args

Additional validator-specific parameters

Return Value

ValidationResult

ValidationResult containing validated data or error messages