Skip to content

Email verification API slow or timing out? Why SMTP checks take seconds, and how to design for it

· 7 min read · Email validation

An email verification API is slow because, unlike most APIs, its answer depends on a third party: the recipient's mail server. The verifier looks up MX records, opens an SMTP connection, and asks whether the mailbox exists, and that server decides how fast to reply. Most pingutil checks take one to five seconds; a slow or defensive mail server can push one to about 25 seconds, at which point we stop and return status: "unknown" with reason: "timeout". You can't make the remote server faster, so design the integration so no person ever waits on the slow case.

Where the seconds go

A full check is several network round trips in sequence:

  1. DNS: resolve the domain's MX records, then the A/AAAA records of the chosen mail host.
  2. TCP connect to port 25 on that host. If it's unreachable, try the next MX by priority.
  3. Banner and EHLO. The server greets, the client introduces itself.
  4. STARTTLS if offered, which adds a TLS handshake.
  5. MAIL FROM and RCPT TO for the address being checked. The RCPT TO reply is the answer. No message is sent.
  6. A second RCPT TO for a random address on the same domain, to detect catch-all servers.

On a well-run server each step takes milliseconds. Things get slow when servers defend themselves against exactly this kind of traffic.

Greylisting

A greylisting server temporarily rejects the first attempt from an unknown sender with a 4xx code and expects a retry minutes later. A verifier can't wait minutes inside an API call, so it returns unknown with reason: "greylisted". The greylisting post covers the mechanics.

Tarpitting

Some servers deliberately slow down replies to connections they find suspicious, holding the banner or each response for several seconds. It's a spam defence: legitimate senders tolerate a slow conversation, high-volume spam tools give up. A verifier talking to a tarpitting server spends most of its time waiting.

Slow or dead MX hosts

Domains often list backup MX hosts that are misconfigured, firewalled or long gone. If the primary is down, every dead host in the list costs a full connect timeout before the next one is tried.

Blocks and rate limits

Large providers and security gateways limit how many SMTP conversations they'll accept from one source. When the verifier hits that, the result is unknown with reason: "blocked" or "rate_limited", sometimes after a slow refusal.

What the slow cases look like in a response

Every slow outcome is an unknown with a specific reason. These are the real values /v1/verify returns:

reason What happened Worth re-checking? Cached by us
timeout The server didn't answer in time Yes, soon No
connection_failed Couldn't connect to any MX host Yes, later No
greylisted Temporary 4xx rejection Yes, after an hour or more 1 hour
blocked The server refused the verifier Maybe, later 1 hour
rate_limited The server is limiting checks Yes, later 1 hour
smtp_error An unexpected SMTP reply Maybe No
dns_error DNS lookup failed Yes, soon No
smtp_unavailable Only DNS checks could run Yes, later No

We cache greylisted, blocked and rate-limited answers for an hour because they describe the remote server's current behaviour, and hammering it makes things worse. Timeouts, connection failures and DNS errors might be transient on our side, so they aren't cached; the next request tries again.

When there was an SMTP reply, the smtp field carries it (code, enhanced, message), and mx_host tells you which server answered. Log both. They're the fastest way to tell "this domain is always slow" from "something changed today".

Two kinds of caller, two timeouts

Caller Who waits Client timeout On timeout
Signup form, checkout, lead form A person 3 to 5 seconds Accept, mark unverified, re-check async
CRM sync, list cleaning, nightly job Nobody About 30 seconds Retry later with backoff

For background work, set the timeout just above the provider's own ceiling, so you get the provider's unknown/timeout answer instead of an aborted request. Ours stops at about 25 seconds, so 30 is right. For a batch call (/v1/verify/batch, up to 50 addresses), addresses that run out of time come back as unknown/timeout individually; one slow domain doesn't fail the whole batch.

For people, the deadline has nothing to do with the provider. It's how long you're willing to make someone stare at a spinner.

A signup flow that never waits on the slow case

The pattern: run cheap checks inline, give the full check a short deadline, and finish anything unresolved in the background.

// verify-at-signup.ts (Node 18+, TypeScript)
type VerifyResult = {
  email: string | null;
  status: 'valid' | 'invalid' | 'risky' | 'unknown';
  reason: string;
  score: number;
  did_you_mean: string | null;
  cached: boolean;
  checked_at: string;
};

const KEY = process.env.PINGUTIL_KEY!;

export async function verifyEmail(email: string, timeoutMs: number): Promise<VerifyResult | null> {
  try {
    const res = await fetch('https://pingutil.com/v1/verify', {
      method: 'POST',
      headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
      body: JSON.stringify({ email }),
      signal: AbortSignal.timeout(timeoutMs),
    });
    if (!res.ok) return null; // 429, 5xx: treat as "no answer"
    return (await res.json()) as VerifyResult;
  } catch {
    return null; // our deadline hit, or a network error
  }
}

export async function handleSignup(email: string) {
  const result = await verifyEmail(email, 4000);

  if (result?.status === 'invalid') {
    return { ok: false, error: 'This address cannot receive email.', did_you_mean: result.did_you_mean };
  }

  const needsRecheck = result === null || result.status === 'unknown';
  const user = await createUser({
    email,
    email_status: result?.status ?? 'unverified',
    email_reason: result?.reason ?? 'not_checked',
    email_recheck_after: needsRecheck ? new Date(Date.now() + 60 * 60 * 1000) : null,
  });

  await sendConfirmationEmail(user); // always: verification is not proof of ownership
  return { ok: true, userId: user.id };
}

createUser and sendConfirmationEmail are yours. The rules encoded here:

  • Only a definite invalid blocks. Everything else, including a timeout or a 429, lets the person in.
  • did_you_mean is returned to the form so a typo like gmial.com gets fixed while the user is still there.
  • Unresolved addresses get a re-check time, an hour out, which clears the one-hour cache on greylisted answers.

If you want an instant gate on top of this, pingutil's /v1/lookup with skip_enrichment: true returns the domain category (disposable, free, company and so on) and a spam verdict in milliseconds, without any SMTP traffic. It won't tell you a mailbox exists, but it catches disposable domains and randomized addresses before the slower check even starts. The guide on signup risk scoring combines both.

The background re-check

A small scheduled job picks up anything marked for re-check:

// recheck-job.ts, run every 15 minutes from cron or your job runner
import { verifyEmail } from './verify-at-signup';

export async function recheckPending() {
  const due = await findUsers({ email_recheck_after_lte: new Date(), limit: 50 });

  for (const user of due) {
    const r = await verifyEmail(user.email, 30_000);
    const attempts = (user.email_recheck_attempts ?? 0) + 1;

    if (r && r.status !== 'unknown') {
      await updateUser(user.id, { email_status: r.status, email_reason: r.reason, email_recheck_after: null });
      continue;
    }

    // Back off: 1h, 4h, 24h, then stop and leave it unknown.
    const delays = [1, 4, 24].map((h) => h * 60 * 60 * 1000);
    await updateUser(user.id, {
      email_reason: r?.reason ?? 'not_checked',
      email_recheck_attempts: attempts,
      email_recheck_after: attempts <= delays.length ? new Date(Date.now() + delays[attempts - 1]) : null,
    });
  }
}

Stop after a few attempts. Some servers never answer verifiers, and that's a permanent property of the domain, not a temporary glitch. At that point the confirmation email is your real check: if the user clicks the link, the address works.

Every request counts toward your daily verification budget, so re-check on a schedule rather than in a tight loop, and stay under the 60-requests-a-minute account rate limit.

Cache on your side too

We cache results for 30 days, but cached answers still count toward the budget, and a round trip is still a round trip. Keep your own record of the last result per address (status, reason, checked_at) and skip the call when a definite result is recent. That matters most for login-time or checkout checks where the same address shows up repeatedly. Caching domain lookups covers keys and TTLs; the same logic applies to verification.

Treating unknown honestly

unknown means the check couldn't finish, nothing more. Don't read it as a soft invalid. Count it separately in dashboards, don't feed it into bounce-rate estimates, and don't let a CRM workflow silently convert it to "bad". The statuses explainer has the full reason list, and the API integration guide puts timeouts, retries and caching together for production.

The one-line rule: give people a deadline measured in seconds, give machines one just above the provider's ceiling, and send everything unresolved to a background queue.

Questions people ask

Why is my email verification API so slow?
A full verification holds an SMTP conversation with the recipient's mail server, and that server sets the pace. Greylisting, deliberate delays (tarpitting), unreachable backup MX hosts and slow TLS handshakes can each add seconds. Most checks finish in one to five seconds, but some take far longer.
What timeout should I use when calling an email verification API?
For background jobs, a client timeout slightly above the provider's own ceiling, about 30 seconds for pingutil. For signup forms, a short deadline of a few seconds, treating a timeout as unknown and finishing the check in the background.
Should I block a signup if email verification times out?
No. A timeout tells you nothing about the address. Let the user continue, mark the address as unverified, and verify it again asynchronously. Block only on definite invalid results.