Skip to content

Email address validator that real world needs, for ActiveModel 4+.

License

Notifications You must be signed in to change notification settings

bary822/real_world_email_validator

Repository files navigation

Build Status

real_world_email_validator

Email address validator that real world needs, for ActiveModel 3+.

Validating email address is hard. Its format definition varies on all kinds of systems depending on its generation, thus, hard. This validator does the job based on RFC 5322, but not exactly. It does few additional validations to make sure the email address works well on almost all kinds of systems, regardless its generations.

Read more about this on wikipedia.

Requirements

  • Ruby 2.4+
  • ActiveModel 3+

Install

gem install real_world_email_validator

or if you use bundler:

bundle add real_world_email_validator

Usage

class MyCompany
  include ::ActiveModel::Model

  attr_accessor :email

  validates :email, real_world_email: true
end

my_company = MyCompany.new

my_company.email = '[email protected]'
my_company.valid?
=> true

my_company.email = 'fo [email protected]'
my_company.valid?
=> false

About

Email address validator that real world needs, for ActiveModel 4+.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages