about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-07-05 20:57:24 +0200
committerGitHub <noreply@github.com>2018-07-05 20:57:24 +0200
commit32a4b524fb95799cfebd9a9e76ef42019d22c5f1 (patch)
tree87d1f1206359c2cbfb5c4ab2144e7777964d377d /app
parent4b198b172d0924c2cf9c3f19b3cc6238c140b1f0 (diff)
In e-mail validator, fallback from MX to A record (#7955)
Fix #7831
Diffstat (limited to 'app')
-rw-r--r--app/validators/email_mx_validator.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/validators/email_mx_validator.rb b/app/validators/email_mx_validator.rb
index 3cc5853c6..e9e6b56e8 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