Email validation with specific domains in Rails 3
What is the best way开发者_如何学JAVA to exlude certain email addresses (in the validation) in Rails3? I want to exclude domains like "hotmail.com, live.com and gmail.com".
Thanks
Maybe u can get some ideas from here: Rails 3 - Help with a Email Validation Regex It doesnt give a working solution thou..
begin
Mail::Address.new(email)
#valid
rescue Mail::Field::ParseError => e
#invalid
end
精彩评论