Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validates_email_address_of

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validates_email_address_of

  • 0.0.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

validates_email_address_of

This provides an email validator for ActiveRecord 3.

Installation

Add this line to your application's Gemfile:

gem 'validates_email_address_of'

And then execute:

$ bundle

Or install it yourself as:

$ gem install validates_email_address_of

Usage

Here is the quick and dirty way to include validates_email_address_of

class User < ActiveRecord::Base
  attr_accessible :email, :password, :password_confirmation
  has_secure_password
  validates :email, :email_address => true
end

There are three separate validation tests that get more and more complete. Each test is independent of the others. While all test are indepent if a lower level test fails it will skip the high level test. All test run by default.

Format

This is a basic RegEx validation and only checks that the email is in the correct format. You can enable or disable by specifying the :format option.

validates :email, :email_address => { :format => false }

MX

This test gets even more acurate than just checking the format. This checks that the domain has at least one MX record attached to it. this can be disabled similarly to format, except with the :mx option.

validates :email, :email_address => { :mx => false }

SMTP Address Verification

This is the ultimate test. This will actually contact the mail server and ask it to verify that the provided email exists. While this guarentees the email will exist it is slow, due to the slow run we suggest only running this test on create. This can be controlled with the :smtp option.

validates :email, :email_address => { :smtp => flase }

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 18 Jul 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc