Article
7 Best Ruby Gems for Email Validation in 2026 (Compared)
By Unlimited Verifier Team ·

Summary
The best Ruby gem for most Rails models is email_validator, which checks format and MX records. Format and MX checks cannot confirm that an inbox exists, so bulk cleaning needs a mailbox-level verification service called from a background job.The best Ruby gem for email validation in most Rails apps is email_validator, which handles format and MX checks in a model. For mailbox-level verification, our top pick is Unlimited Verifier, because a format or MX check cannot confirm that an inbox exists.
This guide is for Rails and plain-Ruby developers, and for marketers and agencies who hand developers CSV files. It covers seven options, shows where each one stops working, and walks through a backfill with the arithmetic. It is based on public documentation and each project's README. We did not benchmark any of these tools.
Quick answer
- Best overall: Unlimited Verifier for mailbox-level and bulk checks, paired with a Ruby gem for format checks.
- Best Rails model validator: email_validator, with an optional MX lookup.
- Best self-hosted pipeline: Truemail, which chains regex, MX and SMTP steps you control.
- Best zero-dependency baseline: Ruby's standard library (a URI regex plus Resolv for DNS).
- Rule of thumb: check format at the form, verify mailboxes in a background job, and re-verify the full list quarterly.
Which Ruby gems are best for email validation?
The right choice depends on which layer you need. Format checks catch typos, MX checks catch domains that don't accept mail, and only a mailbox-level check tests whether a specific inbox accepts mail. For the broader concept, see real-time email validation.
Quick picks
- Best overall for lists and mailbox checks: Unlimited Verifier.
- Best for a Rails model: email_validator.
- Best self-hosted pipeline: Truemail.
- Best for parsing before validating: the mail gem.
- Best if you already pay a vendor: that vendor's Ruby SDK or REST API.
| Tool | Starting price | Free tier | Catch-all handling | Best for |
|---|---|---|---|---|
| Unlimited Verifier | $0 Free; Pro $29/mo ($25/mo billed annually) | Yes: 25 lists/mo × 150 emails, 750 deep verifications, no API | Detects catch-alls, routes them to Risky | Bulk cleans and API checks from Ruby |
| Truemail | Free, open source | n/a (library) | You interpret SMTP responses | Configurable in-app pipeline you operate |
| email_validator | Free, open source | n/a (library) | None; format and MX only | Rails model validation |
| Vendor Ruby SDKs | Varies | Varies | Vendor-specific categories | Teams already on one vendor |
| mail gem | Free, open source | n/a (library) | None; parser only | Parsing and normalizing addresses |
| Ruby stdlib (URI, Resolv) | Free, built in | n/a | None | Zero-dependency baseline |
| Direct REST calls (Net::HTTP) | Varies | Varies | Varies by vendor | Thin, swappable integration |
Bottom line: no single gem covers every layer, so match each tool to the layer your workflow actually needs.
How do Ruby email validators check an address?
Validators work in layers, and each one answers a different question. Syntax asks whether the string looks like an address. MX asks whether the domain has mail servers, using DNS. SMTP asks whether the receiving server will accept a recipient, using a RCPT TO probe described in RFC 5321.
Syntax is harder than it looks. The grammar in RFC 5322 allows quoted local parts and comments, so a strict regex rejects some unusual addresses that are deliverable. Most production code uses a lenient pattern and lets later checks decide.
The SMTP layer is where Ruby apps run into trouble. Many major cloud providers restrict outbound port 25 by default. Receiving servers greylist unfamiliar senders, returning temporary 4xx responses, and some rate-limit repeated probes. Catch-all servers accept any recipient, so a 250 response doesn't prove the mailbox exists. Browser-side checks only improve typing feedback; see client side vs server side email validation for where each layer belongs.
Bottom line: a regex plus an MX lookup catches typos and dead domains. Only a mailbox-level check tests the inbox itself, and running it reliably takes infrastructure.
How we compared (and limitations)
Each option was judged on five criteria:
- Layer coverage: syntax, MX, SMTP, catch-all, disposable and role-based detection.
- Where it runs: inside your process, on infrastructure you operate, or as a vendor-hosted API.
- Failure behavior: how it handles DNS timeouts and temporary SMTP errors, and whether a failure can block a request.
- Cost at volume: what re-checking a full list each quarter costs over a year.
- Maintenance signals: release history, README clarity and license.
Limitations. Library behavior changes between versions, so check each repository's release history before adopting anything here. Accuracy figures are vendor claims, not independent results. No validator can predict whether a real person reads your mail.
Bottom line: treat this as a map of layers and trade-offs, then confirm current details in each project's documentation.
The 7 best Ruby email validation options, reviewed
1. Unlimited Verifier (best overall for bulk and mailbox checks)
Unlimited Verifier is a hosted bulk verification service, not a Ruby gem. You upload a CSV or Excel file (up to 10MB, with the email column detected automatically) or call its REST API. It runs syntax, domain, MX and SMTP mailbox checks and sorts each address into Valid, Risky or Invalid. Its catch-all email verification routes catch-all domains to Risky instead of passing them as valid, and disposable and role-based addresses are flagged.
Standard verification is unlimited on every plan, including Free, with no per-email fees. The API is a separate allowance: Pro includes API access for 100,000 emails a month, with bulk requests of up to 10,000 emails each. The company states 99.5% accuracy for deep verification. That is the vendor's own figure, so test it on a sample of your list.
Key features
- Syntax, domain, MX and SMTP mailbox checks
- Catch-all detection with Risky routing, plus disposable and role-based flags
- CSV or Excel in (10MB limit); CSV, Excel or JSON out
- REST API with API keys: single checks and bulk batches of up to 10,000
- A free email checker for one-off addresses
- Verification engine published as open source on GitHub
Pros
- Mailbox checks run on the vendor's side, so your app doesn't operate port 25 probes
- Valid, Risky and Invalid map directly to Ruby branching: accept, hold, reject
- Standard verification isn't metered, so a quarterly full-list pass doesn't change the bill
Cons
- No native Rails, ESP, CRM or Zapier integrations; you export, verify and re-import, or call the API
- No Ruby client in the verified feature set, so you write a small
Net::HTTPwrapper - API access is Pro-only and capped at 100,000 emails a month
- Per-list caps of 150 emails on Free and 25,000 on Pro, so large lists must be split
Best for: Rails and Ruby teams that want format checks in the app and mailbox-level verification for bulk cleanups and API-driven checks.
Where it falls short: checking every keystroke in-process. A gem fits that layer better.
Pricing: Free ($0) includes 25 lists a month of up to 150 emails each, 750 deep verifications a month, no API access, and results kept 24 hours. Pro is $29/month or $25/month billed annually, with unlimited lists of up to 25,000 emails each, 25,000 deep verifications a month, API access (100,000 emails a month), and results kept 30 days.
Tip: run format checks in the app first and send only addresses that pass to the verifier. That keeps your API allowance for real candidates.
2. Truemail (best layered pipeline inside Ruby)
Truemail is an open-source gem that runs an address through a configurable chain: regex, MX lookup, an SMTP probe, and optional blacklist or whitelist lists. Its advantage is control. Each step, its timeout and its per-environment settings live in your codebase, and you can disable any step you don't want.
The SMTP step has real operational costs. The probe needs a sender address and runs from your own egress IP, so port 25 access, IP reputation and greylisting all shape results. SMTP alone doesn't cleanly separate catch-all domains from real mailboxes, so you write the logic that interprets responses.
Key features
- Chained checks: regex, MX, SMTP and lists
- Blacklist and whitelist support
- Per-environment configuration
Pros
- Full control over each step and timeout
- Validation stays inside infrastructure you control
Cons
- SMTP results depend on your IP reputation and port 25 access
- You own catch-all interpretation and greylisting retries
- More configuration surface than a one-line validator
Best for: teams that want validation logic in their own code and can run SMTP probes from reliable infrastructure.
Where it falls short: cleaning large existing lists, where you'd rather not operate SMTP probes yourself.
Pricing: open source. Check the license in the gem's repository before you depend on it.
Tip: run the SMTP step in a background job, never inside a web request. Cache MX lookups per domain, but not SMTP results, which are specific to each mailbox.
3. email_validator (best Rails model validator)
email_validator adds an email validator to ActiveModel, so Rails models check addresses the same way they check other attributes. The basic setup is one line: validates :email, email: true. Adding mx: true turns on a DNS MX lookup, which checks that the domain accepts mail rather than just matching a pattern.
It stops at the domain. An address on a real domain with no such mailbox still passes.
Key features
- ActiveModel validator with format checking
- Optional MX lookup
- Simple model-level configuration
Pros
- One line in a model, easy to review in code
- MX checks catch domains that don't accept mail at all
Cons
- No SMTP mailbox check
- No catch-all or disposable classification
- MX lookups add DNS latency inside what is otherwise a fast validation step
Best for: signup forms and model-level validation in Rails.
Where it falls short: deciding whether a mailbox exists or whether a list is safe to send to.
Pricing: free and open source.
Tip: MX results repeat per domain, not per address. For bulk imports, cache MX results by domain, since large lists concentrate on a small set of common providers.
4. Vendor Ruby SDKs (best if you already pay a verifier)
Several verification vendors publish Ruby client gems that wrap their REST endpoints. Gem names, maintenance status and supported Ruby versions change, so confirm the latest release and activity on RubyGems before adopting one. An SDK moves the mailbox work off your servers, which solves the port 25 problem, but each vendor's result categories are its own.
Key features
- Mailbox-level checks run by the vendor
- Vendor-defined result categories
- Usually one call per address
Pros
- No SMTP infrastructure to run
- Consistent response objects inside your codebase
Cons
- Metered pricing grows with every re-check (see email verification pricing)
- Category logic is vendor-specific, so switching means rewriting suppression rules
- Third-party gem maintenance varies, so a dependency can go stale
Best for: teams already under contract with a vendor that want its checks through a familiar client.
Where it falls short: teams that want to avoid lock-in or keep re-verification costs flat.
Pricing: varies by vendor and is usually metered.
Tip: write a thin adapter that maps vendor categories to your own valid, hold and reject states. Switching vendors then changes one file instead of every suppression rule.
5. The mail gem (best for parsing before validating)
The mail gem is a widely used Ruby library for building and parsing email messages. Its Mail::Address class parses an address string and exposes its parts, including the local part and domain. It raises an exception on some malformed input, so wrap calls in a rescue.
It is a parser, not a verifier. A parseable address can still bounce, but correct parsing handles unusual-but-valid syntax that hand-written regexes often reject.
Key features
- RFC-aware address parsing
- Access to local part and domain
- Part of a mature messaging library
Pros
- Handles quoted local parts and other valid edge cases better than a hand-rolled regex
- Useful for normalizing input before other checks
Cons
- No DNS or SMTP checks
- Exception-based errors need wrapping in your own code
Best for: normalizing addresses and extracting domains before MX or bulk checks.
Where it falls short: any deliverability decision.
Pricing: free and open source.
Tip: parse first, reject parse failures, then check each unique domain once. Deduplicating domains means one MX lookup per provider rather than one per row.
6. Ruby standard library: URI and Resolv (best zero-dependency baseline)
Ruby ships with what you need for a basic first layer. URI::MailTo::EMAIL_REGEXP is a pragmatic pattern from the URI library, and Resolv performs DNS lookups, including MX queries. Together they give you format and domain checks with no gems.
The regex is a practical subset of the RFC grammar, written for mailto: URIs. Resolv is synchronous, so set timeouts before calling it from a web request.
require "uri"
require "resolv"
def mx_records?(domain)
Resolv::DNS.open do |dns|
dns.getresources(domain, Resolv::DNS::Resource::IN::MX).any?
end
rescue Resolv::ResolvError, Resolv::ResolvTimeout
false
end
URI::MailTo::EMAIL_REGEXP.match?("jane@example.com") && mx_records?("example.com")
Key features
- No dependencies
- Built-in regex and DNS lookups
- Works in any Ruby process, including scripts
Pros
- Zero maintenance burden
- Easy to audit line by line
Cons
- No SMTP mailbox check
- Synchronous DNS can stall requests when resolvers are slow
- The regex accepts some addresses a mailbox won't
Best for: a minimal first layer in any Ruby project.
Where it falls short: mailbox-level or catch-all decisions.
Pricing: free; built into Ruby.
Tip: the rescue above treats a DNS failure as "no MX," which can wrongly reject a real domain during a resolver outage. Decide whether a timeout should block signup, defer to a background check or pass with a flag, and code that choice explicitly.
7. Direct REST calls with Net::HTTP (best for a thin, swappable integration)
If you don't want a vendor SDK, you can call any verifier's REST API from Ruby with Net::HTTP, which ships with Ruby. The dependency lives in your code instead of a third-party gem, and you can change vendors by swapping one adapter. Copy endpoint paths and payload formats from each vendor's documentation rather than guessing them.
Key features
- Standard
Net::HTTPcalls, no gem to update - Works with any verifier that offers a REST API
- Full control over timeouts, batching and retries
Pros
- No third-party dependency in your supply chain
- You decide how bulk requests are sized and paced
Cons
- You write authentication, batching and retry logic yourself
- Rate limits must be handled explicitly (see email validation API rate limits explained)
- Result categories remain vendor-specific
Best for: teams that want a small, auditable integration with no gem.
Where it falls short: teams that want a vetted client with retries built in.
Pricing: the Ruby side is free. The verifier is priced under its own model.
Tip: wrap each call in retries with exponential backoff, and cap concurrency so a backfill doesn't exhaust your rate limit.
Bottom line: a Ruby app can call any verifier's API directly, but the retry logic and category mapping become your responsibility.
How do you verify a Ruby app's email list with Unlimited Verifier?
This workflow pairs an in-app format check with a one-time backfill and then keeps new signups clean. It works with the web upload for lists and the API for signups.
- Add a format check to the model. Use the email_validator line from section 3 so malformed input never reaches the database.
- Export existing addresses to CSV. The scope below is illustrative; adjust it to your schema.
require "csv"
CSV.open("users.csv", "w") do |csv|
csv << ["email"]
User.where(unsubscribed_at: nil).find_each { |user| csv << [user.email] }
end
- Split files to fit your plan. Pro allows up to 25,000 emails per list and Free allows 150. Keep each file under the 10MB upload limit. If you don't have one yet, sign up for a free account.
- Upload and verify each list. The email column is detected automatically.
- Sort the results. Valid stays active, Invalid is suppressed, and Risky is held for review.
- Spend deep verifications on Risky. Pro includes 25,000 a month and Free includes 750.
- Export as CSV, Excel or JSON and store the file. Results are kept 24 hours on Free and 30 days on Pro, so download promptly.
- Re-apply the decisions in batches. Adjust the column names to match your export's headers. Batching keeps the
INclause manageable on large lists.
require "csv"
rows = CSV.read("results.csv", headers: true)
invalid = rows.select { |row| row["Status"] == "Invalid" }.map { |row| row["Email"] }
invalid.each_slice(1_000) do |batch|
User.where(email: batch).update_all(email_status: "invalid") # assumes an email_status column
end
- Automate new signups. Create a key on the email verification API page, then call the bulk endpoint from a background job as part of your email verification API and automation setup.
- Repeat the full-list pass quarterly.
Worked example. A SaaS app has 60,000 users and adds 900 signups a week, about 3,900 a month (900 × 52 ÷ 12).
- Backfill on Pro: the 60,000 addresses can go as three web uploads (25,000 + 25,000 + 10,000), or as six API requests of 10,000 each.
- API allowance: if the backfill runs through the API, it uses 60,000 of 100,000 monthly emails (60%).
- Ongoing signups: 3,900 a month is 3.9% of the same allowance.
- Worst case: a quarterly pass through the API plus a normal month of signups totals 60,000 + 3,900 = 63,900, still under 100,000.
- Cost: $25 × 12 = $300 a year on annual Pro, with standard verification unlimited.
On Free, there is no API, so signups go through a weekly manual upload. The limit is 25 lists × 150 emails = 3,750 emails a month.
Bottom line: one backfill, a background job for signups and a quarterly full pass keep the workflow small and the bill predictable.
Which option should you choose?
For most Ruby teams, the answer is one format gem plus one mailbox-level verifier. Match your situation to the right tool:
| Your situation | Pick | Why |
|---|---|---|
| Rails signup form, format only | email_validator | One line, optional MX |
| Bulk cleanup of an existing list | Unlimited Verifier | Upload, sort, re-import |
| Automated checks from a Ruby job | Unlimited Verifier API (Pro) | Bulk batches up to 10,000 |
| Full control inside your codebase | Truemail | Configurable chain, you own SMTP |
| Zero dependencies | Ruby stdlib | Built in and auditable |
| Locked into one vendor | Vendor SDK or REST API | Matches an existing contract |
| Parsing messy input | mail gem | RFC-aware parsing |
| Prospect lists, not signups | Verifier plus email verification for sales prospecting | Different list quality profile |
For a broader vendor comparison, see the best email verification tools. Before wiring checks into a signup flow, read how to add real-time email verification to signup forms. If your front end also validates input, how to validate email in JavaScript covers that layer.
Bottom line: pick by layer and workflow, not by which gem has the most stars.
What mistakes do Ruby teams make with email validation?
- Shipping a regex and calling it verification. A regex can't tell you whether a mailbox exists.
- Running SMTP probes inside web requests. Port 25 blocks, greylisting and timeouts will slow or break signups. Move them to background jobs.
- Treating a
250response as proof. Catch-all servers accept everything, so classify those addresses as Risky. - Blocking signups on DNS timeouts without a decision. Decide in advance whether a lookup failure blocks, defers or passes with a flag.
- Deleting Risky addresses outright. Some are real readers at strict corporate domains. Segment them by engagement instead.
- Re-importing without suppressing. If Invalid addresses aren't stored as suppressed, the next sync brings them back. Keep email list maintenance best practices in your routine.
- Treating verification as compliance. Verification doesn't make a list lawful. Read email verification compliance and hygiene alongside the FTC's CAN-SPAM compliance guide. Google's sender guidelines cite a spam rate below 0.3% for bulk senders.
Hard-bounce thresholds also vary by provider. As a conservative working target, keep hard bounces under 1% per send.
Bottom line: most Ruby validation failures come from treating one layer as the whole job.
Verdict
For most Ruby teams, the winning setup is a format check in the app and a mailbox-level verifier for everything that matters. Unlimited Verifier is our top pick for that second layer. Standard verification is unlimited on every plan, its Valid, Risky and Invalid output maps cleanly to Ruby logic, and Pro's API allowance of 100,000 emails a month covers signup volume for many mid-sized apps.
Use email_validator or the Ruby standard library for the first layer, Truemail if you want to own SMTP checks, and a vendor SDK only if you're already committed to that vendor.
Bottom line: validate format in the app, verify mailboxes in the background, and start on the Free plan with your next list.
Three-layer validation pipeline
| Step | Question answered | Ruby tool | Action on fail |
|---|---|---|---|
| 1. Syntax | Does it look like an address? | email_validator or regex | Reject at the form |
| 2. MX | Does the domain accept mail? | Resolv (MX lookup) | Reject or flag |
| 3. Mailbox | Does this inbox accept mail? | Verifier API via Net::HTTP | Label valid, risky, or invalid |
Run step 1 inline, run steps 2 and 3 in a background job, and store each result in its own column so you can re-run only the failed layer later.
Frequently asked questions
Is email_validator enough for a Rails app?
email_validator is enough for rejecting malformed addresses and domains with no mail servers at the form level. It cannot confirm that a specific mailbox exists, so bounce-prone lists still need a mailbox-level check run in a background job.
Does a regex validate email addresses correctly?
A regex can catch obvious typos but cannot fully match the RFC 5322 grammar, which allows quoted local parts and comments. Most production code uses a lenient pattern and relies on later DNS or SMTP checks to catch the rest.
What is a catch-all email domain?
A catch-all domain is a mail server set to accept mail for any address at that domain, so an SMTP probe returns a success even when the mailbox does not exist. Verifiers usually label these as risky rather than valid.
Can Ruby confirm a mailbox exists without sending an email?
Ruby can open an SMTP session and issue a RCPT TO probe without sending a message body, which can indicate whether a server accepts the recipient. Results are not fully reliable because many servers hide or randomize responses.
Is Truemail free to use?
Yes, Truemail is open source and free to install. You operate the pipeline yourself, so you are responsible for interpreting SMTP responses and managing any rate limits or IP reputation issues.
Should email validation run in the form or in a background job?
Run format checks in the form for instant feedback, and run MX or mailbox checks in a background job so slow DNS or SMTP lookups do not block the user. Store the result on the record for later use.
How often should an email list be re-verified?
Re-verify a full list about quarterly and verify new sign-ups as they arrive. Addresses decay over time as people change jobs or close accounts, so older verification results go stale.
How do I validate a CSV of emails from Ruby?
Read the CSV with the standard library, normalize and deduplicate addresses, then send them in batches to a verification API or local checker through Net::HTTP. Write results back to a new column rather than overwriting the source file.
Does an MX record prove an inbox is active?
No. An MX record only shows that a domain has mail servers configured. It says nothing about whether a particular local part exists or accepts mail.
Is the mail gem a validator?
The mail gem is primarily a parser and message builder. It can help parse and normalize addresses before validation, but it does not check whether an address is deliverable.
Cut Bounces and Protect Your Sender Reputation With Unlimited Email Verification
Every invalid address you send to hurts your sender reputation and your inbox placement. Verifying your list before each send means fewer bounces, healthier deliverability, and a predictable cost. With Unlimited Verifier, standard verification is unlimited on every plan, with no per-email fees.
Unlimited Verifier checks syntax, domain, MX records and the SMTP mailbox. It also detects catch-all domains and flags disposable and role-based addresses. Export a CSV from your email platform or CRM, upload and verify the list, then re-import the clean results. You can also automate checks with the email verification API.
| Free | Pro | |
|---|---|---|
| Price | $0 | $29/month ($25/month billed annually) |
| Lists | 25 a month, up to 150 emails each | Unlimited, up to 25,000 emails each |
| Deep verifications | 750 a month | 25,000 a month |
| API access | No | Yes (100,000 emails a month) |
| Result retention | 24 hours | 30 days |
Why teams choose Unlimited Verifier
- Unlimited standard verification on all plans, including Free, with no per-email fees.
- Catch-all detection so you know which domains accept every address.
- Clear Valid / Risky / Invalid results, exportable as CSV, Excel or JSON.
- An open-source verification engine you can inspect on GitHub.
Unlimited Verifier states 99.5% accuracy for deep verification.
Create a free account and verify your next list before you hit send.
Want to test a single address first? Try the free email checker.