Skip to content

stw/email_valid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email::Valid is a simple class to check the validity of email addresses, copied from the perl Email::Valid module.

if Email::Valid.address(email_address)
  # do something
end

Call the class method:

if Email::Valid.address(email_address)
  # do something
end

or the instance methods:

email = Email::Valid.new(:check_domain => true, :check_rfc822 => true)

if email.valid(email_address)
  # do something
else 
  raise "Invalid Email: #{email.errors.join ', '}"
end

Possible arguments to Email::Valid.new

:check_domain - checks the mx record for the domain, default true

:check_rfc822 - checks the address against the rfc822 pattern, default true

Other instance methods:

valid_domain(email) - returns true if it finds a valid mx record, false otherwise

valid_rfc822(email) - returns true if it matches the rfc822 pattern, false otherwise

This is an incomplete adaptation of the perl Email::Valid module.

search.cpan.org/~rjbs/Email-Valid-0.184/lib/Email/Valid.pm

About

Validate an email address

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages