Integrations

Rails integration

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.

  • Status: Setup guide
  • One line in your model

RailsGemfile and model

What you add
# 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 made for it, with a daily credit cap, 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

Typical uses.

Set it up. 4 steps.

The short version of the full setup guide, 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.

Updated · Maintained by the email-validation.org team