PhonyRails Build Status Coverage Status GitHub issues Gem Version

This gem provide you library to validate, parsing and format email. Check is email is real or not.

Installation

Add this line to your application's Gemfile:

gem 'cogi_email'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cogi_email

Usage

Validation

Check if a string is a valid email address.

CogiEmail.validate? '[email protected]' # => true

Normalization

Normalize phone numer to international format.

CogiEmail.normalize '[email protected]' # => '[email protected]'
CogiEmail.normalize '(Nobi)<[email protected]>' # => '[email protected]'

Validate email domain

Check if email domain is valid by making a DNS lookup.

CogiEmail.valid_email_domain? '[email protected]' # => true
CogiEmail.valid_email_domain? 'nobi.younet@localhost' # => false

Check if real email

Check if an email address is real or not.

An email address is real if:

  • Is valid
  • Has MX DNS record
  • Can send a test email
CogiEmail.real_email? '[email protected]' # => true
CogiEmail.real_email? 'nobi.younet@localhost' # => false

Credit

Thank you Kamil Ciemniewski so much for writing email_verifier gem. I reference his gem to re-writing email checker for this gem.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Don't forget to add tests and run rspec before creating a pull request :)

See all contributors on https://github.com/hoahm/cogi_email/graphs/contributors.