Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

validates_email_with_smtp method

  • Loading branch information...
commit 4df57184a36ccf094e817f66bc04c3b1f84fd816 1 parent ecaac07
Jussi Uusi-Illikainen authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/validates_email_with_smtp.rb
View
8 lib/validates_email_with_smtp.rb
@@ -8,8 +8,12 @@ def self.included(base)
end
module ClassMethods
- def validates_email_with_smtp(*args)
-
+ def validates_email_with_smtp(*attrs)
+ validates_each(attrs) do |record,attr,value|
+ if MailCheck.run(value).invalid?
+ record.errors.add(attr,:invalid, :value => value)
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.