Truemail Email Validator

Truemail is a Ruby gem that verifies email addresses via Regex, DNS, SMTP, and more, to make sure an email address exists and is valid.

At its most basic, it is extremely simple to use. (Note that providing the verifier’s — your — email is required before it will do what you ask.)

require 'truemail'

Truemail.configure do |config|
  config.verifier_email = 'verifier@example.com'
end

Truemail.validate('email@example.com') # => returns Truemail::Validator instance
Truemail.valid?('email@example.com')   # => returns Boolean

One obvious use case is if you have people sign up for a newsletter or otherwise use email to register on your app/blog/forum, you can integrate the above verification easily and filter out a large part of the fake addresses that you’re bound to encounter.

Personally, I was just wondering a few days ago whether this would be easy to do, as I will sometimes contact someone by figuring out the email format used by their organization (first_name.last_name@my_company.com, for instance), which usually works but why not check for exceptions? One could even write a script to try automatically a number of such standard formats until getting the right one. Could that ever be useful, while remaining ethical? You tell me.

Full documentation is available through the link above.