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