Fix NULL MX handling and tighten DNS resolving specs (#28607)
This commit is contained in:
@@ -47,6 +47,7 @@ class EmailMxValidator < ActiveModel::Validator
|
||||
dns.timeouts = 5
|
||||
|
||||
records = dns.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }
|
||||
next if records == [''] # This domain explicitly rejects emails
|
||||
|
||||
([domain] + records).uniq.each do |hostname|
|
||||
ips.concat(dns.getresources(hostname, Resolv::DNS::Resource::IN::A).to_a.map { |e| e.address.to_s })
|
||||
|
||||
Reference in New Issue
Block a user