# Verify emails in Magento and Adobe Commerce

Source: https://docs.rocketverifier.com/integrations/magento

> Install the RocketVerifier_EmailVerification module, enable it under Stores, Configuration, RocketVerifier, Email Verification, and paste your API key. Undeliverable and disposable addresses are rejected on the server at customer registration, guest checkout and newsletter signup, across the storefront, REST and GraphQL.

The RocketVerifier module verifies email addresses inside Magento itself, so every storefront, headless frontend and API client gets the same protection.

## Install the module

Install with Composer, then enable the module and its cache type:

```bash
composer require rocketverifier/module-email-verification
bin/magento module:enable RocketVerifier_EmailVerification
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:enable rocketverifier
bin/magento cache:flush
```

To install by hand, copy the module to `app/code/RocketVerifier/EmailVerification/` and run the same `module:enable` and `setup:upgrade` steps.

## Configure it

Open **Stores, Configuration, RocketVerifier, Email Verification**:

| Field | Default | What it does |
| --- | --- | --- |
| Enabled | No | Turns verification on. |
| API Key | | Your key from [API keys](https://app.rocketverifier.com/dashboard/api-keys). Stored encrypted, at default or website scope. |
| Timeout (seconds) | 5 | 5 to 30. Sent to the API as `timeout`. |
| Block Undeliverable Emails | Yes | Rejects `undeliverable` addresses. The message follows the `sub_status` and suggests `did_you_mean` when the API spots a typo. |
| Block Disposable Emails | Yes | Rejects disposable addresses. Set it to No to accept them. |
| Fail Open | Yes | Accepts the address when the API cannot be reached, times out or returns an error, including when credits run out. |
| Customer Registration, Guest Checkout, Newsletter Subscription | Yes | Turns each check on or off. |

`deliverable`, `risky` and `unknown` addresses are always accepted. You can also set the key from the command line:

```bash
bin/magento config:sensitive:set rocketverifier/general/api_key rv_live_your_key_here
```

## Where addresses are checked

| Where | Areas |
| --- | --- |
| Customer registration | Storefront, REST (`POST /V1/customers`) and GraphQL (`createCustomerV2`). |
| Guest checkout | The standard checkout, plus every guest order before payment is placed, including GraphQL `placeOrder` and express checkouts. |
| Newsletter signup | The footer form, REST and GraphQL (`subscribeEmailToNewsletter`). |

## Credits and caching

- 1 credit per verified address. `unknown` results are free.
- Successful results are cached for 10 minutes in the **RocketVerifier Results** cache type (`rocketverifier`). Errors are never cached.
- API errors are logged to `var/log/system.log`: errors for a bad key or an empty balance, warnings for timeouts.

## Test it

Use a sandbox key (`rv_test_`) with `@sandbox.rocketverifier.com` addresses to test registration, guest checkout and the newsletter form for free. `undeliverable@sandbox.rocketverifier.com` is rejected and `deliverable@sandbox.rocketverifier.com` goes through. Every sandbox address is listed under [Try it](https://docs.rocketverifier.com/api/verify#try-it).

## Frequently asked questions

### Does a shopper who retries checkout pay twice?

No. Results are cached for 10 minutes in a dedicated cache type, and a single request never calls the API twice, so a retried checkout or a registration that also subscribes to the newsletter uses one credit.

### What happens if the API is down or credits run out?

With Fail Open on, which is the default, the address is accepted and the error is logged to `var/log/system.log`. Turn Fail Open off to show the shopper a please try again message instead.

### Are admin-created customers checked?

Customers and orders created in the Magento admin are not checked. Customers created through the REST API, including by admin integrations, are.
