app/models/user.rb
# Ensure provided email domain has MX record
Ensure provided email domain has MX record
Ensure provided email domain has MX record
def check_mx_record
    return if ENV['PARTY_DISABLE_DNS'] == 'YES'
    domain = email.split('@').last
    results = Resolv::DNS.open { |dns| dns.getresources(domain, Resolv::DNS::Resource::IN::MX) }
    errors.add(:email, 'domain does not support email (no MX record).') if results.empty?
  end
def check_mx_record return if ENV [ 'PARTY_DISABLE_DNS' ] == 'YES' domain = email . split ( '@' ) . last results = Resolv :: DNS . open { | dns | dns . getresources ( domain , Resolv :: DNS :: Resource :: IN :: MX ) } errors . add ( :email , 'domain does not support email (no MX record).' ) if results . empty? end
Ensure provided email domain has MX record
Ensure provided email domain has MX record
# Disable dns checks