# Mailgun email verification

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

> Import Mailgun bounces and complaints, earn credits back under the bounce guarantee, and verify mailing-list members with results stored as member variables.

## Connect Mailgun

**Step 1**

In RocketVerifier open **Dashboard → Integrations → Mailgun**, paste the credentials below (a Mailgun private API key, region and sending domain) and click **Connect**. They are validated against the platform before anything is saved.

| Field | Required | Where to find it |
| --- | --- | --- |
| API key | Required | Mailgun → API Security → private API key. |
| Region | Required | US (`api.mailgun.net`) or EU (`api.eu.mailgun.net`). |
| Sending domain | Optional | e.g. `mg.example.com`. Needed for the daily bounce import and for bounce-guarantee credits. |
| Webhook signing key | Optional | Sending → Webhooks → HTTP webhook signing key. Needed to accept real-time webhooks. |

Credentials are stored encrypted and are only ever sent to the platform's own API hosts.

## What it syncs

**Sources.** Any mailing list.

**Incremental syncs.** Incremental syncs read the whole source and skip contacts verified within the skip window.

## Schedules and credits

- **Schedule:** manual, daily, weekly or monthly. **Sync now** starts a run immediately. One sync runs per integration at a time, and an address already on its way through another run is never charged twice.
- **Mode:** *Full* checks every contact in the source except those verified in the last *N* days (default 30, range 0 to 365). *Incremental* checks only contacts changed since the last sync. Turn on per-status intervals to re-check unknown and catch-all addresses sooner than valid ones.
- **Credits:** each sync is a regular verification job at 1 credit per unique address. `unknown` results are refunded when the job completes. Addresses you verified recently anywhere in RocketVerifier are written back from that result for free. If the balance is too low, the sync stops with `insufficient_credits` before anything is charged.
- **Quarantine:** optionally re-check risky, catch-all and unknown contacts automatically every 1 to 90 days (default 14), so each one moves to Send or Remove once the result is clear.
- **Results** are written back when the job completes. The sync history in the dashboard shows updated, failed and skipped counts for every run, and a finished run fires the `integration.sync.completed` webhook event.

## Write-back

### Status fields

- `rv_email_status`
- `rv_email_sub_status`
- `rv_email_score`
- `rv_verified_at`
- `rv_email_recommendation`

Member variables (`vars`).

Status is one of `deliverable`, `undeliverable`, `risky` or `unknown`, and sub-status is a [`sub_status`](https://docs.rocketverifier.com/results#sub-status) value (`none` when there is no extra detail). Score runs from 0 to 100, verified-at is an ISO 8601 UTC timestamp, and recommendation is `send`, `review` or `remove` (valid is send; invalid and disposable are remove; risky, catch-all and unknown are review). Field names can be changed in the integration settings, and a blank name keeps the default.

## Actions by result

Pick an action for each result type in the integration settings: *Invalid*, *Disposable*, *Risky*, *Catch-all*, *Unknown* or *Valid*. Actions run after the write-back.

- **Unsubscribe**: Sets the member to `subscribed=no`.

- **Safe by default:** unsubscribe, suppress and delete never apply to catch-all or unknown results, whatever the rule says. Catch-all and unknown contacts include real people, so they can be tagged, moved or paused instead.
- **Preview before acting** writes the results as usual but holds the actions until you approve the run in the sync history.
- **Undo this run** reverses the run's reversible actions, and every run keeps a CSV backup of the contacts it changed.

## Bounce feed setup

The webhook URL is shown on the integration page in the dashboard and has this form:

```text
https://api.rocketverifier.com/webhooks/connectors/mailgun/{integration_id}
```

**Step 1**

Copy the webhook URL shown on the integration page in the dashboard.

**Step 2**

In Mailgun open **Sending → Webhooks** for the sending domain and add the URL for the **Permanent failure**, **Temporary failure** and **Spam complaints** events.

**Step 3**

Paste the domain's **HTTP webhook signing key** into the integration settings. Deliveries are checked against it; replays and deliveries older than 12 hours are rejected.

**Mapping.** Permanent failure → hard bounce, temporary failure → soft bounce, complained → complaint.

**Polling.** With a sending domain set, RocketVerifier also reads the domain's bounces and complaints once a day.
