# Rails Integration: Email Validation

URL: https://email-validation.org/integrations/rails/
Updated: 2026-11-06

> Documentation index: https://email-validation.org/llms.txt

One line in a Rails model fails an email address that cannot receive mail, with an ActiveModel validator built on our Ruby client library. Each address is checked once, and a real person can still sign up when the API cannot answer in time.

[Read the full setup guide](https://email-validation.org/docs/guides/rails/) [Get an API key](https://email-validation.org/signin/)

- Status: Setup guide
- One line in your model

**Rails** Gemfile and model

What you add

```text
# Gemfile
gem "email-validation-rails", path: "vendor/email-validation-rails"

# app/models/user.rb
class User < ApplicationRecord
  validates :email, presence: true, deliverable_email: true
end
```

## At a glance.

- **Status**: **Setup guide.** Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- **For**: Rails developers who want sign-up, checkout and contact forms to refuse addresses that will bounce, and anyone with an ActiveModel class, with or without Rails.
- **You need**: ActiveModel 7.1 or newer, Ruby 3.2 or newer, and an [API key](https://email-validation.org/app/api-keys/) made for it, with a [daily credit cap](https://email-validation.org/docs/authentication/#limits), with the permission Validate addresses.
- **Costs**: 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses and test addresses on sandbox.email-validation.org.
- **Full guide**: [Read the full setup guide](https://email-validation.org/docs/guides/rails/)

## Typical uses.

- **Clean sign-ups**: Add the validator to the email field of your User model, so an address that cannot receive mail gets an error on the form instead of an account.
- **Stricter fields**: Fail disposable addresses on a work email field, or refuse the form when the check cannot finish, with options on that one validation.
- **Your own messages**: Translate or override the English messages in your locale files, or pass message: to one validation. The messages never show the API’s own error text.

## Set it up. 4 steps.

The short version of the [full setup guide](https://email-validation.org/docs/guides/rails/), which stays the reference when a step does not match what you see.

1. **Download the gem**: The gem is not on RubyGems yet. Download it from the guide and unzip it into your app’s vendor/ folder, so that you have vendor/email-validation-rails/.
2. **Add it to your Gemfile**: Add `gem "email-validation-rails", path: "vendor/email-validation-rails"` and run `bundle install`.
3. **Set your key**: Create a key with Validate addresses and a daily credit cap, and set it in your environment as `EV_API_KEY`, or read it from your credentials in the initializer. Never put it in code.
4. **Validate the field**: Add `deliverable_email: true` to the field’s validation, then try `accepted@sandbox.email-validation.org` (passes) and `no_mailbox@sandbox.email-validation.org` (fails) at no cost.

## Good to know.

- Only invalid fails by default. Set block\_disposable to true to fail disposable addresses as well; catch\_all and unknown pass unless you add them to fail\_on.
- When the check cannot finish (a timeout, no connection, a 5xx or 429 answer, no credits or no key), the address passes and a warning goes to Rails.logger with the error code and request id, never the address. With fail\_open set to false, the field gets an error instead.
- Each result is kept in Rails.cache for an hour under a hash of the address, so a form sent again after fixing another field is not checked or charged again. Only the status is kept, and unknown results are not kept.
- A malformed address is refused without a request, and nothing is retried: a slow mail server answers unknown, which passes and is free.
- For [EU data residency](https://email-validation.org/docs/eu-data-residency/), set the base URL in the initializer to `https://api-eu.email-validation.org`: the same key works on both.

## Related

- [The full Rails setup guide](https://email-validation.org/docs/guides/rails/)
- [Validating sign-up forms: what to block and what to accept](https://email-validation.org/docs/guides/signup-form-validation/)
- [Every setting of the validator](https://email-validation.org/docs/guides/rails/#settings)
- [The Ruby client library, for bulk lists and other calls](https://email-validation.org/docs/sdks/ruby/)
- [Statuses and reasons](https://email-validation.org/docs/statuses/)
- [All integrations](https://email-validation.org/integrations/)
