The code was assuming that the record type was MX even though this could be false. Also adjusted some code to also make it easier to test. Note: the behavior when MX records are missing is probably still not right. Closes PR 13654
net/dns' and