public
Description: A plugin to validate submitted emails for format, which can also check that the domain exists.
Homepage: http://rails.savvica.com/2007/11/6/email-veracity-plugin
Clone URL: git://github.com/Empact/validates_email_veracity_of.git
name age message
file .gitignore Tue Jul 15 01:35:37 -0700 2008 Ignore eclipse project file [Empact]
file MIT-LICENSE Tue Nov 06 06:27:22 -0800 2007 Added Rakefile, updated documentation. [cnielsen]
file README.rdoc Thu Aug 21 02:39:43 -0700 2008 .rdoc hint for github's sake [Empact]
file Rakefile Thu Aug 21 02:39:43 -0700 2008 .rdoc hint for github's sake [Empact]
file init.rb Thu Nov 22 06:09:22 -0800 2007 Changed Email#domain_has_servers? so that it is... [cnielsen]
directory lib/ Thu Aug 21 02:55:14 -0700 2008 Hide some classes from the docs [Empact]
directory test/ Tue Jul 15 04:33:56 -0700 2008 Everything is much cleaner when you don't have ... [Empact]
README.rdoc

Validates Email Veracity Of

Author:Carsten Nielsen (mailto:carsten.nielsen@savvica.com) License:MIT Type:Rails Validation Plugin

Validates the form of an email address and verifies it’s domain by checking if there are any mail exchange or address servers associated with it.

Options

  • message
    • Changes the default error message.
  • domain_check
    • Skips server lookup unless true.
  • timeout
    • Time (in seconds) before the domain lookup is skipped. Default is 2.
  • fail_on_timeout
    • Causes validation to fail if a timeout occurs.
  • timeout_message
    • Changes the default timeout error message.
  • mx_only
    • When set, only mail exchange servers (MX) are looked up and the address server (A) lookup is skipped.
  • invalid_domains
    • An array of domain names that are not to be used. Useful for stuff like dodgeit.com and other services.
  • invalid_domain_message
    • Changes the default invalid domain error message.

Examples

  • validates_email_veracity_of :email, :message => ‘is not correct.’
    • Changes the default error message from ‘is invalid.’ to ‘is not correct.’
  • validates_email_veracity_of :email, :domain_check => false
    • Domain lookup is skipped.
  • validates_email_veracity_of :email, :timeout => 0.5
    • Causes the domain lookup to timeout if it does not complete within half a second.
  • validates_email_veracity_of :email, :fail_on_timeout => true, :timeout_message => ‘is invalid.’
    • Causes the validation to fail on timeout and changes the error message to ‘is invalid.’ to obfuscate it.
  • validates_email_veracity_of :email, :mx_only => true
    • The validator will only check the domain for mail exchange (MX) servers, ignoring address servers (A) records.
  • validates_email_veracity_of :email, :invalid_domains => %w[dodgeit.com harvard.edu]
    • Any email addresses @dodgeit.com or @harvard.edu will be rejected.

Notes

  • You will need to be connected to the internet to utilize the remote features of the plugin and to properly run the tests.
  • To run the tests type rake test in the console from the plugin’s root directory.
  • The Resolv library has been known to screw up internally with a nil.include? error if your domain resolver is ill-configured or out of service.