Y
Yves-Eric
Hi all,
Trying to do some email domain validation, I am facing a weird issue
when looking up an MX entry. Here is a three-liner test code:
require 'resolv'
domain = "i-dont-exist-iutjdfuyoxfugy.com"
Resolv:
NS.open { |dns| dns.getresources(domain,
Resolv:
NS::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:
=> [#<Resolv:
NS::Resource::IN::MX:0xb7cde342
@exchange=#<Resolv:
NS::Name: mydomain.com.>, @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:
NS 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.
Thank you,
Trying to do some email domain validation, I am facing a weird issue
when looking up an MX entry. Here is a three-liner test code:
require 'resolv'
domain = "i-dont-exist-iutjdfuyoxfugy.com"
Resolv:
Resolv:
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:
=> [#<Resolv:
@exchange=#<Resolv:
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:
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.
Thank you,