Skip to content
Snippets Groups Projects
Unverified Commit 32a4b524 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

In e-mail validator, fallback from MX to A record (#7955)

Fix #7831
parent 4b198b17
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@ class EmailMxValidator < ActiveModel::Validator
return true if domain.nil?
records = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::MX).to_a.map { |e| e.exchange.to_s }
records = Resolv::DNS.new.getresources(domain, Resolv::DNS::Resource::IN::A).to_a.map { |e| e.exchange.to_s } if records.empty?
records.empty? || on_blacklist?(records)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment