Skip to content

Marketing & email

Verify emails before sending with Postmark

Verify addresses before the official Postmark Node.js client sends to them, so typos and dead mailboxes never raise the bounce rate Postmark watches on your account.

Updated 2026-11-26

This recipe protects a Postmark account from avoidable bounces. Your app verifies an address when it first sees it, stores the result, and sends through one function that skips undeliverable addresses before the official postmark Node.js client is called. When Postmark itself refuses an address it has deactivated, the same function records that too. There is no native Qelka integration for Postmark; this is a few dozen lines in your backend.

Why Postmark in particular: Postmark is strict about list quality. Its terms of service ask for a bounce rate below 10% of all emails sent, and its servers FAQ warns that a server over the limit can have its sending suspended. Those are Postmark's figures and may change. Most avoidable bounces come from addresses typed wrong at signup or invite, and from old lists. See Email bounces explained.

What you need

  • A Postmark server and its Server API token, a confirmed sender signature or domain, and the message stream you send from (outbound is the default transactional stream).
  • Node.js 18 or later; the current postmark library needs it. Install with npm install postmark @qelka/sdk.
  • A Qelka API key. A sk_test_ key returns simulated results and never spends credits: see Test mode.
  • Environment variables POSTMARK_SERVER_TOKEN and QELKA_API_KEY, read only on the server.
  • An email_status column on the records you send to.

Steps

1. Verify when an address first appears

javascript
import { ApiConnectionError, ApiError, Client } from '@qelka/sdk'

const verifier = new Client({ apiKey: process.env.QELKA_API_KEY, timeoutMs: 15000 })

export async function checkAddress(email) {
  try {
    const result = await verifier.email.verify({ email })
    return { status: result.status, reason: result.reason, suggestion: result.did_you_mean }
  } catch (error) {
    if (error instanceof ApiError) {
      console.warn(`email check skipped: ${error.type} request ${error.requestId}`)
    } else if (error instanceof ApiConnectionError) {
      console.warn(`email check skipped: ${error.message}`)
    } else {
      throw error
    }
    return { status: 'unchecked', reason: null, suggestion: null }
  }
}

Call it where addresses enter: the signup handler, an invite endpoint, a customer import. Store status and reason with the record. full mode, the default, asks the recipient's mail server whether the mailbox exists, which can take several seconds, hence the 15-second timeout. In a form where the person waits, pass { email, mode: 'fast' } instead: it catches typos in the domain, domains that take no mail and disposable inboxes at once, and returns unknown with smtp_not_checked for the rest, which you can check fully afterwards.

When the person is still on the page, refuse an undeliverable answer and show "Did you mean" with the suggestion. A welcome email to a typo is the first bounce of many accounts.

2. Send through one guarded function

javascript
import { ServerClient } from 'postmark'

const postmark = new ServerClient(process.env.POSTMARK_SERVER_TOKEN)

export async function sendToRecipient(recipient, message, markUndeliverable) {
  if (recipient.emailStatus === 'undeliverable') {
    console.info(`send skipped: ${recipient.email} is undeliverable (${recipient.emailReason})`)
    return { sent: false }
  }

  try {
    const response = await postmark.sendEmail({
      From: 'hello@yourdomain.example',
      To: recipient.email,
      Subject: message.subject,
      HtmlBody: message.html,
      TextBody: message.text,
      MessageStream: 'outbound',
    })
    return { sent: true, messageId: response.MessageID }
  } catch (error) {
    if (error.name === 'InactiveRecipientsError') {
      for (const address of error.recipients) await markUndeliverable(address, 'postmark_inactive')
      return { sent: false }
    }
    console.error(`Postmark send failed: ${error.name} ${error.code} ${error.message}`)
    throw error
  }
}
  • Replace From with an address on your confirmed sender signature or domain.
  • markUndeliverable is your own function that sets email_status to undeliverable on the record. Postmark has already deactivated those addresses after a hard bounce or a complaint, so retrying them only produces more refusals.
  • Every other Postmark error, such as an invalid token or a rate limit, is rethrown so your job queue can decide whether to retry.
  • Only undeliverable is skipped. Risky, unknown and unchecked addresses get their transactional mail, because the person asked for it and the address may well work.

3. Keep broadcasts cleaner than transactional mail

If you also send newsletters or announcements through a broadcast stream, apply a stricter rule there:

status and reason Transactional stream Broadcast stream
deliverable Send Send
undeliverable, any reason Skip Skip, and remove from the list
risky with disposable Send Skip
risky with catch_all Send Send in small batches and watch the bounces
risky with mailbox_full Send Hold, and check again later
unknown or unchecked Send Send, and re-check before large sends. Never delete on this result

unknown means the checks could not conclude, often because a provider does not answer mailbox checks or greylisted the check. It is not a bad address. The email reference lists each reason.

4. Re-check old addresses before a large send

Results are cached for 7 days, and a cached result costs the same as a fresh one. Before a large broadcast to addresses you checked long ago, verify them again with fresh: true through a bulk file check or batch calls, and update email_status from the results.

5. Test both sides

Run the guard with POSTMARK_API_TEST as the server token, which Postmark accepts without delivering anything, and a sk_test_ key. With the test key, the part before the @ picks the result: undeliverable@example.com must be skipped, disposable@example.com must reach the transactional branch only, and any other address must be sent.

Handle errors and rate limits

Nothing is billed on errors. 401 and 403 mean a wrong or restricted key, and 402 an empty balance: they end as unchecked here, so the mail still goes out and you should alert on a rising count of unchecked records. The Qelka SDK retries 429 after Retry-After. A key allows 200 requests per 10 seconds, so verify an import in batches rather than one call per row; each check costs 1 credit. See Errors and Rate limits.

Frequently asked questions

What bounce rate does Postmark allow?
Postmark's terms of service and its servers FAQ ask for a bounce rate below 10% of all emails sent. A server whose rate nears that limit shows orange in Postmark, above it red, and its sending can be suspended. Those are Postmark's rules and they may change, so read the current terms. Verifying addresses before the first send removes the most avoidable share of bounces: typos and mailboxes that do not exist.
What is an inactive recipient in Postmark?
Postmark deactivates an address after a hard bounce or a spam complaint, and its API answers a later send to it with error 406, Inactive recipient. The postmark library raises that as an InactiveRecipientsError with the list of addresses. The code below marks them undeliverable in your database so you stop trying.
How do I test without sending real email?
Use Postmark's test server token, POSTMARK_API_TEST, which accepts the request without delivering it, together with a sk_test_ key, which returns simulated results and spends no credits. With the test key, undeliverable@example.com and disposable@example.com exercise the skip branches.

More in Marketing & email

All integrations

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time