Skip to content

A plugin for validate format of email and blacklist some domains.

Notifications You must be signed in to change notification settings

johnvuko/validates_email_format_of

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

validates_email_format_of

A plugin for validate format of email and blacklist or whitelist some domains.

Installation

Include the gem in your Gemfile:

gem 'validates_email_format_of', :git => 'https://github.com/jonathantribouharet/validates_email_format_of'

Usage

In your model:

class User < ActiveRecord::Base
	validates :email, :email => true
end

Or

class User < ActiveRecord::Base
	validates_email_format_of :email
end

For blacklist or whitelist some domains add in a initializer:

EmailValidator.blacklist_domains = ['yopmail.com', 'jetable.org']
EmailValidator.whitelist_domains = ['gmail.com', 'hotmail.com']

I18n support

  • errors.messages.not_an_email_adress is used for an invalid format
  • errors.messages.not_a_valid_email_adress is used for an invalid domain

Warning

The validation downcase the email.

About

A plugin for validate format of email and blacklist some domains.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages