diff --git a/Gemfile b/Gemfile index bc0f206b24d..3db5808b419 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,6 @@ else end gem 'mail' -gem 'mime-types', require: 'mime/types/columnar' gem 'mini_mime' gem 'mini_suffix' diff --git a/Gemfile.lock b/Gemfile.lock index dc9c7731645..c28d3be59f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -163,16 +163,13 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.5.9) lru_redux (1.1.0) - mail (2.6.6) - mime-types (>= 1.16, < 4) + mail (2.7.0) + mini_mime (>= 0.1.1) memory_profiler (0.9.10) message_bus (2.1.2) rack (>= 1.1.3) metaclass (0.0.4) method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) mini_mime (0.1.3) mini_portile2 (2.3.0) mini_racer (0.1.15) @@ -445,7 +442,6 @@ DEPENDENCIES mail memory_profiler message_bus - mime-types mini_mime mini_racer mini_suffix diff --git a/lib/email.rb b/lib/email.rb index 0bae995d178..ed9182980db 100644 --- a/lib/email.rb +++ b/lib/email.rb @@ -8,16 +8,7 @@ module Email def self.is_valid?(email) return false unless String === email - - parsed = Mail::Address.new(email) - - # Don't allow for a TLD by itself list (sam@localhost) - # The Grammar is: (local_part "@" domain) / local_part ... need to discard latter - parsed.address == email && - parsed.local != parsed.address && - parsed&.domain.split(".").size > 1 - rescue Mail::Field::ParseError - false + !!(EmailValidator.email_regex =~ email) end def self.downcase(email)