2 extend ActiveSupport::Concern
6 def canonical_email(email)
7 local_part, domain = email.split("@")
9 local_part.sub!(/\+.*$/, "")
11 local_part.delete!(".") if %w[gmail.com googlemail.com].include?(domain)
13 "#{local_part}@#{domain}"
17 # get list of MX servers for a domains
18 def domain_mx_servers(domain)
19 Resolv::DNS.open do |dns|
20 dns.getresources(domain, Resolv::DNS::Resource::IN::MX).collect { |mx| mx.exchange.to_s }