E-commerce
Spree Commerce email validation integration
A Ruby gem for your Spree Commerce store checks the email of each checkout and customer account with our API when it is set or changed, in the storefront, through the APIs, at sign-up and in the admin. By default only a definite invalid is refused, with one sentence on the email field, and an address goes through when our side cannot answer.
Read the full setup guideGet an API key
- Setup guide
- A file you download
# Gemfile
gem "email-validation-spree", path: "vendor/email-validation-spree"
# config/initializers/email_validation.rb (optional)
EmailValidation::Spree.configure do |config|
config.logger = Rails.logger
config.stop_on = %w[invalid disposable]
endAt 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
- Spree Commerce stores (4.10, 5.x or 6.0) that want the checkout and sign-up to refuse an address that cannot receive the order confirmation, the receipt or the shipping notices.
- You need
- A Spree 4.10, 5.x or 6.0 store with 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, test addresses on sandbox.email-validation.org, addresses on reserved domains such as example.com and, in a bulk list, repeats of an address (charged once).
- Full guide
- Read the full setup guide
Typical uses.
Guest checkout
The guest’s email is checked when it is typed at checkout (an order on Spree 4 and 5, a cart on Spree 6); an address that cannot receive mail gets an error on the field and can be corrected.
Customer accounts
Sign-ups and email changes on your customer class are checked the same way, and a signed-in customer’s checkout takes that checked address.
Stricter rules
Add disposable, catch_all or unknown to stop_on, word the sentences yourself, or refuse when the check cannot finish with fail_open set to false.
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.
Download the gem
The gem is not on RubyGems. Download it from the guide and unzip it into your Rails app’s vendor/ folder (server/vendor/ in a create-spree-app project, after spree eject).
Add it to your Gemfile
Add
gem "email-validation-spree", path: "vendor/email-validation-spree"and runbundle install. There is no generator and no migration.Set your key
Set it in the server’s environment as
EV_API_KEY, or read it from your credentials in the initializer, then restart the app. Never put it in code.Try it free
Check
no_mailbox@sandbox.email-validation.orgwithbin/rails runnerandEmailValidation::Spree.check: it is refused. Then go through a guest checkout on a development store with your own address.
Good to know.
Only invalid is refused by default; stop_on adds disposable, catch_all or unknown.
It fails open: no key, a timeout, a network error, a rate limit or any error answer lets the address through.
Spree copies a signed-in customer’s account email onto their checkout without validations, so that address is checked on the account. Accounts made before you installed the gem were not checked.
Each check uses one credit; unknown results and sandbox addresses are free.
Connect Spree Commerce.
Test it on our sandbox addresses for free, then on your own contacts.
Updated · Maintained by: Email Validation LLC