Integrations · Email platforms
Validate your Ghost members
Check the email addresses of your Ghost site's members and give each member one label for its result, so you can filter them in Ghost Admin, act on them in bulk, or send a post only to the members that passed. Two pieces, use either or both: a script you run on your own computer checks the members you have as one bulk list, and a small relay you deploy to your own Cloudflare account checks each new member, and each changed address, soon after. Neither one deletes a member or sends an email. Both are in email-validation-ghost.zip: ghost.mjs (the script), relay.mjs (the relay), webhook.json and the MIT licence.
Ghost has no hook before a sign-up: its webhooks fire after Ghost has saved a member. So this cleans up after sign-ups; it never refuses or slows down one.
Your Ghost Admin API key
It needs Ghost 5 or 6, self-hosted, or Ghost(Pro) on Publisher, Business or Custom (Ghost's Starter plan has no custom integrations, Admin API or webhooks). In Ghost Admin, open Settings → Advanced → Integrations → Add custom integration and name it, say, "email-validation.org". Copy its Admin API key and your site's admin URL (such as https://example.ghost.io). The key has full admin access to your site's content and members, so keep it secret: it never leaves your computer or your Worker, and is used only to sign a short-lived token for each request to your site.
What it writes
| Label | The address is |
|---|---|
ev-valid | valid, and the action is send or send_with_caution |
ev-valid-remove | valid, but the action is remove: a spam trap or a frequent complainer; do not send to it |
ev-invalid | invalid: no such mailbox or domain, or malformed |
ev-catch-all | catch_all: on a domain that accepts every address |
ev-unknown | unknown: not settled this time, checked again later |
ev-disposable | disposable: a throwaway address |
A member holds one of these labels at a time: when its address is checked again with another result, the old one is replaced. Every other label of the member's stays as it is. --label-prefix (and the relay's EV_LABEL_PREFIX) changes the ev- prefix. In Ghost Admin you can then filter your members by label, act on the filtered members in bulk (for example unsubscribe them from email), or send a post to the members with a label, such as ev-valid. Ghost's docs show no way to leave a label out of a send: to keep the bad addresses out of your newsletters, unsubscribe them, or send to ev-valid, which no spam trap or complainer holds.
Run the script
It needs Node 22.18 or later (nothing to install: it has no dependencies), an API key of ours from the API keys page with the permission Bulk lists (off by default: turn it on when you create the key), and the Ghost Admin API key above.
Try it free first, on a test member: in Ghost Admin, open Members → New member (never your site's sign-up form, which emails a sign-in link; Ghost's help describes its welcome emails as sent to members who sign up on your site). Give it the address no_mailbox@sandbox.email-validation.org and the label email-check-test, switch every newsletter off, and send it nothing: it is a test address, free, and it receives no mail. Then run the script on that label only:
cd email-validation-ghost # the unzipped folder
export EV_API_KEY=… GHOST_ADMIN_API_URL=https://example.ghost.io GHOST_ADMIN_API_KEY=…
node ghost.mjs --filter 'label:email-check-test' --dry-run # must count 1 member
node ghost.mjs --filter 'label:email-check-test' # the test member gets ev-invalidIn Windows PowerShell (5.1 or 7):
cd email-validation-ghost # the unzipped folder
$env:EV_API_KEY = "…"; $env:GHOST_ADMIN_API_URL = "https://example.ghost.io"; $env:GHOST_ADMIN_API_KEY = "…"
node ghost.mjs --filter 'label:email-check-test' --dry-run # must count 1 member
node ghost.mjs --filter 'label:email-check-test' # the test member gets ev-invalidNever try it without the filter: a run without one checks, and pays for, every member without a result. Then delete the test member, and run it on your real members, --dry-run first:
node ghost.mjs --dry-run # counts what it would check; spends and writes nothing
node ghost.mjs # checks and labels--filter NQLchecks only the members a Ghost filter matches (for examplestatus:free, orlabel:<slug>).--unsubscribe invalid,disposable,valid_removealso unsubscribes those free members from every newsletter (valid_removenames theev-valid-removemembers;validis refused). A resultunknownwith the reasontimeoutorinternal_errornever unsubscribes anyone, even withunknownnamed: that check failed on our side, and the member is checked again later. Paid, comped and gift members only ever get our label.--revalidatechecks members whose address was checked before;--region euchecks and keeps the list in the EU, with the same key.- Running the relay too? Add
--with-relay, so an address the relay already checked is not checked (and paid) again.
The script does not ask before it spends: each distinct address uses one credit; unknown results, duplicates, malformed and test addresses are free. It prints member ids, job ids and counts, never an address or a key. It never deletes a member or a label, never changes an address, a name, a tier or a subscription, and never sends an email. If Ghost ever answers a member without its labels, it stops and writes nothing.
Run it again
Run the same command again after any stop (no credits, a closed laptop, a Ghost outage, a regenerated key, the bulk list still running): it resumes the same bulk list and never pays twice (within the 30 days a list is kept). Run it from the same folder each time (or pass the same --state FILE and --marks FILE): the files it keeps there hold the bulk list it is working on and a hash of each address it checked, never an address or a key. An address it checked is not checked again unless it changes, so you can run it on a schedule, for example daily with cron.
Ghost publishes no limit for its Admin API. The script sends 300 requests a minute by default (--rate N, at most 600; lower it for a small self-hosted server), and writing back takes two or three requests per member. The check itself runs on our side and is not slowed by Ghost.
Exit codes: 0 done, 1 a write failed or the run stopped (run it again), 2 wrong arguments, 75 the bulk list was still running when the script stopped waiting (run it again later).
Check new members as they join
The relay is a Cloudflare Worker in your own account. It needs an API key of ours with Validate addresses (on by default), your site's admin URL and Admin API key, and a Secret you choose for the webhooks: 16 to 256 printable characters, no spaces. No terminal? Deploy it from the Cloudflare dashboard instead. Or deploy it from the unzipped folder:
npx wrangler deploy relay.mjs --name ev-ghost-relay --compatibility-date 2026-10-01
npx wrangler secret put EV_API_KEY --name ev-ghost-relay # our API key
npx wrangler secret put GHOST_ADMIN_API_URL --name ev-ghost-relay # your site's admin URL
npx wrangler secret put GHOST_ADMIN_API_KEY --name ev-ghost-relay # the Admin API key
npx wrangler secret put GHOST_WEBHOOK_SECRET --name ev-ghost-relay # the webhooks' SecretAdd --var EV_REGION:eu to the deploy command to have addresses validated in the EU and their results stored there. EV_LABEL_PREFIX and EV_UNSUBSCRIBE_STATUSES work as the script's --label-prefix and --unsubscribe.
Then, in the same custom integration in Ghost Admin, add two webhooks, both with the relay's address and the same Secret as GHOST_WEBHOOK_SECRET (webhook.json lists the two):
| Event | Target URL |
|---|---|
| Member added | https://ev-ghost-relay.<your-subdomain>.workers.dev/?event=member.added |
| Member updated | https://ev-ghost-relay.<your-subdomain>.workers.dev/?event=member.edited |
The relay checks a member when it is added, and again only when its address changes: its own label write never causes a second check.
Deploy the relay from the Cloudflare dashboard
- In the Cloudflare dashboard, open Workers & Pages → Create and choose Create Worker (the "Hello World" starter). Name it
ev-ghost-relayand select Deploy. - Select Edit code, delete the starter code, paste the whole of
relay.mjsfrom the box below (Copy takes all of it) and select Deploy. - In the Worker's Settings → Variables and Secrets, select Add for each value below, then Deploy:
- type Secret:
EV_API_KEY(our API key),GHOST_ADMIN_API_URL(your site's admin URL),GHOST_ADMIN_API_KEY(the Admin API key) andGHOST_WEBHOOK_SECRET(the webhooks' Secret); - type Text, if you want them:
EV_REGION=eu,EV_LABEL_PREFIX,EV_UNSUBSCRIBE_STATUSES.
- type Secret:
- The relay's address, such as
https://ev-ghost-relay.<your-subdomain>.workers.dev/, is on the Worker's page: use it in the two webhooks' Target URL, with its?event=as above.
Or open relay.mjs as plain text in a new tab, select all of it and copy it from there.
Who can call the relay
Ghost signs every delivery with the webhooks' Secret, and the relay acts only on deliveries signed with it in the last 5 minutes; an unsigned delivery is refused. It reads the member itself with your key. A large import reaches the relay as many deliveries: after an import, run the script, which checks the members the relay did not.
Try it once: add a test member as above, with another test address, no_dns@sandbox.email-validation.org (a member the script already checked proves nothing). Within a few seconds it should hold the label ev-invalid. Then delete it. From then on every new member and every changed address is a paid check, one credit each.
Good to know
- Ending the access. Delete the two webhooks and the custom integration in Ghost Admin (Settings → Advanced → Integrations), and the relay's Worker.
- Free checks. Results with the status
unknownare free, and so are malformed addresses, duplicates and test addresses.