From: "Iñaki Baz Castillo" Date: 2009-02-23T20:01:56+09:00 Subject: Re: DNS MX lookup issue: local machine returned as MX for an non-existant domain! 2009/2/23 Yves-Eric : > require 'resolv' > domain = "i-dont-exist-iutjdfuyoxfugy.com" > Resolv::DNS.open { |dns| dns.getresources(domain, > Resolv::DNS::Resource::IN::MX)} > > On my development machine, this returns an empty list, as expected > (the domain does not exist, it cannot have an MX record!). > However, in my production environment, the same code returns: > => [# @exchange=#, @preference=10>] > > It returns the production machine itself as a valid MX for a domain > that does not exist! > > I double-checked on the command line that "nslookup -q=mx i-dont-exist- > iutjdfuyoxfugy.com" indeed returns NXDOMAIN... > > Could someone please explain to me why this may be happening, and how > to fix it? Howcome Resolv::DNS is returning an MX record for a domain > that does not exist?! As a temporary workaround, I am simply filtering > out mydomain.com from the MX list, but it really bugs me not knowing > what the root of the problem is. So you confirm that "nslookup -q=mx i-dont-exist-iutjdfuyoxfugy.com" also returns your local hostname? If so, then it's not a bug in Ruby Resolv::DNS but in your DNS client configuration in your server. -- Iñaki Baz Castillo