Integrations · Email platforms
Check SendPulse subscribers and mailing lists
Check a SendPulse mailing list before a campaign, and each new subscriber before it joins. One module with no dependencies, copied into your own server, checks a sign-up before it is added to the list. A small tool checks the list's contacts from a terminal: it reports the ones to set aside and, when you ask, unsubscribes them from that list. By default only a definite invalid is set aside; everything else stays as before.
Download it: email-validation-sendpulse.zip holds the module as TypeScript (email-validation-sendpulse.ts) and as JavaScript (email-validation-sendpulse.mjs), the list tool (sendpulse.mjs) and the MIT licence.
What you need
- An API key of ours from the API keys page with Validate addresses (on by default).
- Your SendPulse REST API ID and Secret: in SendPulse, open Settings → API → Client credentials and copy both. The module and the tool trade them for an access token that lasts an hour and ask for a new one before it ends.
- For the module: your server's code, in anything with
fetch(Node 22 or later, Bun, Deno, Cloudflare Workers). Copyemail-validation-sendpulse.tsinto a TypeScript project, oremail-validation-sendpulse.mjsinto a JavaScript one. Import the.tsfile with its extension under Node 22.18 or later, Deno or Bun; under a bundler, leave the extension out. - For the list tool: Node 22.18 or later (nothing to install: it has no dependencies).
Our key goes only to our API; the SendPulse ID and secret only to SendPulse's token address, and the token only to api.sendpulse.com. Redirects are never followed, and nothing is logged.
A new subscriber
Instead of adding a sign-up to the list yourself, hand it to the checker: it checks the address, then adds it unless it is blocked. Make it once per process, so every sign-up reuses one SendPulse access token.
import { createSubscribeChecked } from './email-validation-sendpulse.ts'; // .mjs in JavaScript
const subscribe = createSubscribeChecked({
apiKey: process.env.EV_API_KEY,
sendpulse: { clientId: process.env.SENDPULSE_CLIENT_ID, clientSecret: process.env.SENDPULSE_CLIENT_SECRET },
verdictField: 'ev_status', // optional: a variable of the list that holds the answer
});
const { outcome } = await subscribe({ email: form.email, list: LIST_ID, variables: { name: form.name } });
// outcome: 'subscribed', 'blocked' (never sent to SendPulse) or 'not_an_address'With verdictField, the answer's status is written to that variable, and only a definite answer: a timeout, a failure or an unknown sends no value, so the variable keeps what it held. confirmation: { senderEmail, lang, templateId } asks SendPulse for double opt-in; the sender address must be activated in your SendPulse account. When SendPulse refuses the credentials, the list or the request, the call throws a SendPulseError with a code; a check we could not make never throws. createEmailCheck(options) checks one address, for your own code.
Try it free first
Check one of our free test addresses (on a domain that receives no mail) without touching SendPulse:
import { createEmailCheck } from './email-validation-sendpulse.ts';
const check = createEmailCheck({ apiKey: process.env.EV_API_KEY });
console.log(await check('no_mailbox@sandbox.email-validation.org'));
// { blocked: true, status: 'invalid', reason: 'no_mailbox', error: null, … }Checks of our test addresses are free. Never send to them, or to any address you made up, through SendPulse: a send to an address that cannot receive mail bounces and hurts your sending reputation.
A list before a campaign
To see the tool work first, make a new mailing list in SendPulse holding two contacts you add by hand, no_mailbox@sandbox.email-validation.org and accepted@sandbox.email-validation.org (the tool never sets aside every address of a list, so one must pass), and keep that list out of every campaign and automation. You need the list's id: SendPulse's API lists your mailing lists with their ids (GET /addressbooks). Then:
cd email-validation-sendpulse # the unzipped folder
export EV_API_KEY=… SENDPULSE_CLIENT_ID=… SENDPULSE_CLIENT_SECRET=…
LIST_ID="…" # the test list's id
node sendpulse.mjs --list "$LIST_ID" # report only: changes nothing
node sendpulse.mjs --list "$LIST_ID" --apply # unsubscribes the test contact from the listIn Windows PowerShell (5.1 or 7):
cd email-validation-sendpulse # the unzipped folder
$env:EV_API_KEY = "…"; $env:SENDPULSE_CLIENT_ID = "…"; $env:SENDPULSE_CLIENT_SECRET = "…"
$ListId = "…" # the test list's id
node sendpulse.mjs --list $ListId # report only: changes nothing
node sendpulse.mjs --list $ListId --apply # unsubscribes the test contact from the listThen delete the test list. On a real list, the tool reads the contacts SendPulse mails (status New or Active, 100 a page) and checks each distinct address once; contacts with any other status are never checked or changed. A report checks every distinct address (each one credit), so it costs the same as a clean: run it with --apply when you are ready.
With --apply, the blocked addresses are unsubscribed from that list, up to 100 a request: SendPulse keeps each contact as unsubscribed and sends it nothing. --action delete deletes them from the list instead, which cannot be undone. The tool never removes every mailed address of a list, and changes nothing when our API refuses the key. If SendPulse stops it part way, the message says how many were changed; running the same command again is safe, since those contacts are no longer mailed and are not read again. cleanList(options) does the same from your own code.
Other options: --block invalid,disposable sets aside more statuses, --region eu checks in the EU, --concurrency N runs up to 10 checks at once (default 4), and --verdict-field NAME lets an earlier definite verdict in that variable decide when the new check gives none.
Exit codes: 0 done (also when our API stopped the checks for a key, credits, daily cap or rate limit answer: the report says so and the rest are kept), 1 SendPulse refused or failed, or the tool stopped itself (every mailed address of the list would be set aside, or the list runs past 10,000 pages of 100), 2 wrong arguments or a missing key. The report prints the blocked addresses to your terminal only; nothing is written to a file.
How it decides
- What is blocked.
invalidby default;block(or--block) also takesdisposable,catch_allandunknown(validcannot be blocked). Anunknownthat comes from our side (a timeout or our own failure) is never blocked. - It fails open. No key, a timeout (6 seconds per check by default,
timeoutMs), a network error, a rate limit or any error answer keeps the address: a sign-up is added, a contact stays on the list. Checks are never retried. A value that is no address (a link, a name) is never sent to our API. - Credits. Each check uses one credit (
unknownresults, malformed and sandbox addresses are free).region: 'eu'checks in the EU, athttps://api-eu.email-validation.org. - SendPulse's limit. SendPulse allows 10 requests a second, so two calls to it start at least 150 ms apart. A refusal or a rate limit from SendPulse stops the run instead of retrying it.