From 32a4b524fb95799cfebd9a9e76ef42019d22c5f1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 5 Jul 2018 20:57:24 +0200 Subject: [PATCH] In e-mail validator, fallback from MX to A record (#7955) Fix #7831 --- app/validators/email_mx_validator.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/validators/email_mx_validator.rb b/app/validators/email_mx_validator.rb index 3cc5853c6ed..e9e6b56e876 100644 --- a/app/validators/email_mx_validator.rb +++ b/app/validators/email_mx_validator.rb @@ -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