Fix NULL MX handling and tighten DNS resolving specs (#28607)
This commit is contained in:
parent
9699ea22d6
commit
6ad0fb5a77
4 changed files with 16 additions and 1 deletions
|
@ -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 })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue