# Mailgun Integration: Email Validation

URL: https://email-validation.org/integrations/mailgun/
Updated: 2026-11-29

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

A sync script you run on your own computer checks the members of a Mailgun mailing list as one bulk list and writes each verdict into five of the member’s vars, keeping the rest. Nothing else changes unless you ask: it can unsubscribe the members or suppress the addresses you name.

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

- Status: Setup guide
- A script you download

**mailgun.mjs** Node 22.18 or later

Terminal

```bash
export EV_API_KEY=…  MAILGUN_API_KEY=…
node mailgun.mjs --lists
node mailgun.mjs --list <list address> --dry-run
node mailgun.mjs --list <list address>
```

## 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**: Teams who send newsletters and announcements to Mailgun mailing lists and want the members that will bounce, or should not be mailed at all, marked before the next send.
- **You need**: Node 22.18 or later, an [API key](https://email-validation.org/app/api-keys/) of ours with Bulk lists (off by default), and a Mailgun account API key whose role may update mailing lists (a domain sending key can only send).
- **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 and, in a bulk list, repeats of an address (charged once).
- **Full guide**: [Read the full setup guide](https://email-validation.org/docs/guides/mailgun/)

## Typical uses.

- **Know which members to leave out**: Each member gets ev\_status, ev\_reason, ev\_action, ev\_checked\_at and ev\_address\_hash, usable in templates as %recipient.ev\_status%. Spam traps and complainers are valid with the action remove, so filter on ev\_action.
- **Unsubscribe or suppress, if you ask**: Off by default. --unsubscribe invalid,disposable sets those members to unsubscribed on the list; --suppress invalid adds them to your sending domain’s suppressions. Never for valid.
- **Check before a single send**: The guide shows a check with our API to run before you call Mailgun for one message: only a definite invalid holds it back, and every failure lets it through.

## Set it up. 4 steps.

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

1. **Download and unzip**: It is not on a marketplace: download email-validation-mailgun.zip from the guide. It holds mailgun.mjs and the licence.
2. **Find the list**: `node mailgun.mjs --lists` shows your mailing lists with their addresses and member counts. For an EU account, add `--mailgun-region eu`.
3. **Try it free on a test list**: Make a list for the try with one member, no\_mailbox@sandbox.email-validation.org, send nothing to it, and run the script on it: the member is marked invalid. Then delete the list.
4. **Dry run, then run**: `node mailgun.mjs --list <list address> --dry-run` counts what it would check and spends nothing. Run it again without `--dry-run` to check and write the vars.

## Good to know.

- By default it writes only its five vars and keeps every other var: it never deletes, adds or renames a member, and changes no list. Writing vars does not change who receives mail sent to the list address.
- Run the same command again after any stop and it resumes the same bulk list and never pays twice (within the 30 days a list is kept). It prints ids and counts, never a member’s address or a key.
- Mailgun keeps lists in one region: --mailgun-region eu is your Mailgun account’s region, and --region eu is where we check and keep the list.
- Mailgun sends no webhook when a member joins a list, so run the script on a schedule: each run checks only the members without a verdict, and those still unknown.

## Related

- [The full Mailgun setup guide](https://email-validation.org/docs/guides/mailgun/)
- [Try it free on a test list](https://email-validation.org/docs/guides/mailgun/#try)
- [Check an address before you send](https://email-validation.org/docs/guides/mailgun/#before-send)
- [What each status means](https://email-validation.org/docs/statuses/)
- [Mailjet integration](https://email-validation.org/integrations/mailjet/)
- [Resend integration](https://email-validation.org/integrations/resend/)
- [ActiveCampaign integration](https://email-validation.org/integrations/activecampaign/)
- [AWeber integration](https://email-validation.org/integrations/aweber/)
- [All integrations](https://email-validation.org/integrations/)
