Source Code:
(back to article)
<?php $domain = "example.com"; $mxhosts = []; $weight = []; if (dns_get_mx($domain, $mxhosts, $weight)) { for ($i = 0; $i < count($mxhosts); $i++) { echo "Host: " . $mxhosts[$i] . ", Weight: " . $weight[$i] . "<br/>"; } } else { echo "No MX records found for $domain"; }
Result:
Report an issue