Finding MX Records

Jim Reid jim at rfc1035.com
Thu Apr 20 10:45:50 UTC 2000


>>>>> "Matthew" == Matthew Thompson <matthewt at fairplay.co.uk> writes:

    Matthew> I've written a DNS query client in VB (Please no
    Matthew> comments about the choice of language) which takes an
    Matthew> email address and attempts to determine wether the
    Matthew> destination is deliverable. IT performs an query to our
    Matthew> local DNS server and then it either returns a positive
    Matthew> (if it receives MX entries) or queries the NS records it
    Matthew> receives back.

    Matthew> This looks to have worked pretty well so far but a small
    Matthew> number of the failed addresses would appear to have no MX
    Matthew> records associated.

[Scarcasm on]
Dearie me! Some places on the net have broken DNS configurations and
email setups. What is the world coming to?
[Scarcasm off.]

    Matthew> One example is thmc.com.tw

    Matthew> If I perform the query on thmcsrv.thmc.com.tw I get
    Matthew> _exactly_ the same back from that server as well.

    Matthew> So I'm leaft wondering 1. are the addresses valid and 2
    Matthew> how do I know if they are.

I'm not sure what your questions really mean. A reply containing no
answers or even a "this name does not exist" error is a perfectly
valid response from the DNS. If the name servers for some zone return
an answer for a name in that domain, then by definition that answer -
whatever it may be - is valid. [And probably authoritative too.]
Whether that answer is correct or meaningful is neither here nor
there: you get whatever the hostmaster put into the zone file and fed
to his/her name server(s). Garbage in, garbage out and all that...

The thmc.com.tw domain has no MX records. That's why you get its SOA
record in the Authority Section of the reply and an empty Answer
Section. [If only you used dig instead of nslookup, you'd have seen
this for yourself.] This is what's supposed to happen when the domain
exists but there's no name, type and class for the query that was
made. So the thmc.com.tw name servers are doing the Right Thing
considering how they have probably been (mis)configured.

When a name has no MX records, most mail systems will look for an A
record for that name and, if it gets one, try to speak SMTP to that
address. In some cases the mail systems will even follow CNAMEs to
figure out how to deliver the mail. A lookup of an A record for
thmc.com.tw returns 203.69.24.15 - with a zero TTL! - so presumably
that IP address accepts mail for this domain. It does have an SMTP
listener.

So it looks to me like you need to fix your code so that it correctly
deals with names that don't have MX records. It might also be an idea
for you to get hostmaster at thmc.com.tw to fix their broken DNS by
adding MX records and sensible TTLs for the resource records.



More information about the bind-users mailing list