开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜