Ruby SDK · Feature

Email Validation & Verification in Ruby

Check whether an email address is real, deliverable, and safe to accept — before it ever enters your database. The SDK exposes three levels: a fast syntax/MX/disposable check, full SMTP verification, and a batch endpoint for cleaning whole lists.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Three levels of email checking

Not every check needs an SMTP probe. email_info validates syntax and MX and flags disposable providers fast enough to run inline on a sign-up form. validate_email goes further, connecting to the mail server to confirm the mailbox is deliverable and adding role-account, free-provider, and catch-all signals. validate_email_batch applies that advanced check across an entire list in one request.

Prerequisites

1

Fast check with email_info

A lightweight check (no SMTP probe): validates syntax, confirms the domain has MX records, and flags disposable/throwaway providers. Use it inline on sign-up forms.

client = Ipapi::Client.new(api_key: ENV.fetch("IP_API_IO_KEY"))

info = client.email_info("user@example.com")

puts info.syntax.valid?    # true
puts info.disposable?      # false
puts info.mx_records?      # true
puts info.mx_records.first.hostname unless info.mx_records.empty?
2

Full SMTP verification with validate_email

Advanced verification that connects to the mail server to confirm the mailbox is deliverable, and adds role-account, free-provider, catch-all and Gravatar signals.

result = client.validate_email("user@example.com")

puts result.reachable        # "yes" | "no" | "unknown"
if result.smtp
  puts "#{result.smtp.deliverable?} #{result.smtp.catch_all?}"
end
puts result.disposable?      # false
puts result.role_account?    # false  (e.g. info@, support@)
puts result.free?            # false  (e.g. gmail.com)
puts result.suggestion       # typo fix, e.g. "user@gmail.com"
3

Clean a list with validate_email_batch

Advanced-validate up to 100 addresses in one request — the building block for email list cleaning. Raises ArgumentError if the array is empty or longer than 100.

batch = client.validate_email_batch([
  "user@example.com",
  "fake@mailinator.com"
])

puts batch.total_processed        # 2
puts batch.successful_validations # 2

batch.results.each do |email, result|
  puts "#{email} #{result.reachable} #{result.disposable?}"
end
Reference

Response reference

AdvancedEmailValidation (from validate_email)

MethodTypeDescription
emailStringThe address checked
reachableString"yes", "no" or "unknown"
smtpAdvancedSMTP, nilhost_exists?, deliverable?, full_inbox?, catch_all?, disabled?
gravatarAdvancedGravatar, nilgravatar?, gravatar_url
suggestionString, nilSuggested correction for a likely typo
disposable?BooleanThrowaway provider
role_account?BooleanRole address (info@, sales@, …)
free?BooleanFree webmail provider
mx_records?BooleanDomain can receive mail
FAQ

Frequently asked questions

How do I validate an email address in Ruby?

For a fast check, call client.email_info(email) — it validates syntax, confirms the domain has MX records, and flags disposable providers without an SMTP probe. For full deliverability, use client.validate_email(email), which connects to the mail server.

What's the difference between email_info and validate_email?

email_info is a lightweight syntax/MX/disposable check, ideal inline on sign-up forms. validate_email performs advanced SMTP verification and adds role-account, free-provider, catch-all and Gravatar signals — use it before sending important mail or accepting a paying customer.

How do I clean a whole list of emails?

Use client.validate_email_batch(emails) with up to 100 addresses per request — the building block for email list cleaning. It returns a results hash of email to result and raises ArgumentError if the array is empty or longer than 100.

Can it detect disposable / throwaway emails?

Yes. Both email_info and validate_email return a disposable flag (disposable?) for throwaway providers like mailinator.com, so you can reject or down-rank them at sign-up.

Start building with the ip-api.io Ruby SDK

Run gem install ip-api-io, drop in your free API key, and ship in minutes — one client object for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ip-api-io gem is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub