11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/valid_email2/email_validator.rb', line 11
def validate_each(record, attribute, value)
return unless value.present?
options = default_options.merge(self.options)
address = ValidEmail2::Address.new(value)
error(record, attribute) && return unless address.valid?
if options[:disallow_subaddressing]
error(record, attribute) && return if address.subaddressed?
end
if options[:disposable]
error(record, attribute) && return if address.disposable?
end
if options[:disposable_with_whitelist]
error(record, attribute) && return if address.disposable? && !address.whitelisted?
end
if options[:blacklist]
error(record, attribute) && return if address.blacklisted?
end
if options[:mx]
error(record, attribute) && return unless address.valid_mx?
end
end
|