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? 'nobi.younet@gmail.com' # => true
Normalization
Normalize phone numer to international format.
CogiEmail.normalize 'Nobi.younet@gmail.com' # => 'nobi.younet@gmail.com'
CogiEmail.normalize '(Nobi)<nobi.younet@gmail.com>' # => 'nobi.younet@gmail.com'
Validate email domain
Check if email domain is valid by making a DNS lookup.
CogiEmail.valid_email_domain? 'nobi.younet@gmail.com' # => 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? 'nobi.younet@gmail.com' # => 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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - 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.