1 = validates_email_format_of Gem and Rails Plugin
3 Validate e-mail addresses against RFC 2822 and RFC 3696.
9 gem sources -a http://gems.github.com
10 gem install alexdunae-validates_email_format_of
12 Installing as a Ruby on Rails plugin:
14 ./script/plugin install http://github.com/alexdunae/validates_email_format_of.git
19 class Person < ActiveRecord::Base
20 validates_email_format_of :email
23 As of version 1.4, it's possible to run e-mail validation tests (including MX
24 checks) without using ActiveRecord or even touching a database. The
25 <tt>validate_email_format</tt> method will return <tt>nil</tt> on a valid
26 e-mail address or an array of error messages for invalid addresses.
28 results = ValidatesEmailFormatOf::validate_email_format(email, options)
33 puts results.join(', ')
40 String. A custom error message (default is: " does not appear to be a valid e-mail address")
42 Symbol. Specifies when this validation is active (default is :save, other options :create, :update)
44 Boolean. Allow nil values (default is false)
46 Boolean. Allow blank values (default is false)
48 Boolean. Check domain for a valid MX record (default is false)
50 Specifies a method, proc or string to call to determine if the validation should occur
51 (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method,
52 proc or string should return or evaluate to a true or false value.
58 To execute the unit tests run <tt>rake test</tt>.
60 The unit tests for this plugin use an in-memory sqlite3 database.
64 * http://github.com/alexdunae/validates_email_format_of
65 * http://code.dunae.ca/validates_email_format_of.html
69 Written by Alex Dunae (dunae.ca), 2006-09.
71 Thanks to Francis Hwang (http://fhwang.net/) at Diversion Media for creating the 1.1 update.
73 Thanks to Travis Sinnott for creating the 1.3 update.
75 Thanks to Denis Ahearn at Riverock Technologies (http://www.riverocktech.com/) for creating the 1.4 update.
77 Thanks to George Anderson (http://github.com/george) and 'history' (http://github.com/history) for creating the 1.4.1 update.