Skip to content

// transactional email

Via API

SparkPost email verification with pingutil

SparkPost is built for volume, which means a small share of bad addresses turns into a large number of bounces. Checking each new recipient with pingutil before it enters a transmission keeps that share down, while SparkPost's webhooks and suppression list handle addresses that go bad later.

Where it connects: Your code before the Transmissions API, plus SparkPost webhooks and the suppression list

What goes wrong without it

  • We send millions of account notifications a month and even a small slice of dead addresses shows up in our bounce metrics.
  • Our signup forms are scraped by bots and every fake account triggers a transmission.
  • We import users from partner systems with no idea how old those addresses are.

What you can do with SparkPost and pingutil

  • Verify new recipients before their first transmission

    Call /v1/verify when an address is created, and only include it in a transmission once it is not invalid.

  • Clean partner imports in batches

    Send imported addresses through /v1/verify/batch, 50 per call, and drop invalid ones before they ever reach SparkPost.

  • Feed bounce webhooks back into your user table

    Use SparkPost webhooks for bounce events to mark users whose addresses failed, and verify replacements before sending again.

Set it up

  1. 1

    Add PINGUTIL_KEY to the service that creates SparkPost transmissions.

  2. 2

    For a single new address, call POST /v1/verify; for imports, call POST /v1/verify/batch with up to 50 emails.

  3. 3

    Drop recipients with status invalid; keep risky and unknown ones with a flag.

  4. 4

    Create the transmission with POST https://api.sparkpost.com/api/v1/transmissions (api.eu.sparkpost.com for EU accounts).

  5. 5

    Configure a SparkPost webhook for bounce events and mark the matching users.

Batch-verify an import, then send one transmission
type Result = { input: string; status: 'valid' | 'invalid' | 'risky' | 'unknown'; reason: string };

async function verifyBatch(emails: string[]): Promise<Result[] | null> {
  try {
    const res = await fetch('https://pingutil.com/v1/verify/batch', {
      method: 'POST',
      headers: { authorization: 'Bearer ' + process.env.PINGUTIL_KEY, 'content-type': 'application/json' },
      body: JSON.stringify({ emails }), // up to 50 per call
      signal: AbortSignal.timeout(60000),
    });
    if (!res.ok) return null;
    return (await res.json()).results;
  } catch {
    return null;
  }
}

export async function sendToImported(emails: string[]) {
  const keep: string[] = [];
  for (let i = 0; i < emails.length; i += 50) {
    const chunk = emails.slice(i, i + 50);
    const results = await verifyBatch(chunk);
    if (!results) { keep.push(...chunk); continue; } // fail open for this chunk
    for (const r of results) if (r.status !== 'invalid') keep.push(r.input);
  }
  if (keep.length === 0) return;

  await fetch('https://api.sparkpost.com/api/v1/transmissions', {
    method: 'POST',
    headers: { authorization: process.env.SPARKPOST_API_KEY!, 'content-type': 'application/json' },
    body: JSON.stringify({
      recipients: keep.map((email) => ({ address: { email } })),
      content: {
        from: { name: 'YourApp', email: 'notify@mail.yourapp.com' },
        subject: 'Your account is ready',
        text: 'Your account has been moved to YourApp.',
      },
    }),
  });
}

What to do with each result

pingutil resultAction in SparkPost
status invalidLeave the address out of the transmission recipients.
status invalid, reason disposable_domainLeave it out and mark the account for review.
status risky, reason accept_allInclude it; SparkPost bounce webhooks will report it if it fails.
status unknown (smtp_unavailable, timeout)Include it and keep the flag, or re-check later.

Limits to plan for

  • SparkPost has its own Recipient Validation API. pingutil fits when you also want disposable, free-webmail and company classification, or one verifier shared with other tools.
  • pingutil verifies 300 addresses a day (3,000 a month) per account, so it suits new signups and modest imports, not re-verifying a multi-million-address database in one go. Those are Free plan limits; Enterprise has custom limits.
  • Batch calls take as long as the slowest mail server in the batch. Run them in a background job, not in a request path.

SparkPost documentation

SparkPost is a trademark of its owner. This integration uses SparkPost's documented extension points; it is not an official SparkPost app.

Common questions

Do I need to verify every recipient on every transmission?
No. Verify an address once when it enters your system and store the result. pingutil also caches definitive results for 30 days.
What if pingutil is unreachable when the job runs?
Treat the chunk as unchecked and send. Suppression lists and bounce webhooks still protect you from repeat failures.

Stop bad addresses in SparkPost today

Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your SparkPost setup will receive.