How to test transactional email templates: links, content and spam score

· 5 min read · QuickInbox team

  • Email templates
  • Deliverability
  • QA

Transactional emails change more often than anyone remembers: a new logo, a new link, a refactored template. These checks catch the common mistakes automatically.

Checks worth automating

  • Subject is right and personalized where it should be.
  • No unfilled variables: no {{name}}, %NAME% or undefined in the text.
  • Every link works and points to the right environment (no localhost or staging links in production emails).
  • There's a plain-text part, not just HTML.
  • Unsubscribe link exists where the law requires it (marketing, not usually password resets).
  • Spam score is healthy and SPF, DKIM and DMARC pass.

An automated check

Every message that reaches a QuickInbox Business namespace comes with a spam field: a score from 0 to 100 (100 is clean), the SPF, DKIM and DMARC results, and the rules that fired. So one test can check content and deliverability together:

const email = await waitForEmail(tag, { subject: 'Your receipt' });

expect(email.text).not.toMatch(/\{\{|%[A-Z_]+%|undefined/);
expect(email.html).not.toContain('localhost');
expect(email.spam.spf).toBe('pass');
expect(email.spam.dkim).toBe('pass');
expect(email.spam.score).toBeGreaterThanOrEqual(70);

const links = [...email.html.matchAll(/href="([^"]+)"/g)].map((m) => m[1].replace(/&/g, '&'));
for (const url of links.filter((u) => u.startsWith('http'))) {
  const res = await fetch(url, { method: 'HEAD', redirect: 'follow' });
  expect(res.status, url).toBeLessThan(400);
}

waitForEmail is the Business API helper from email testing in Jest.

If the spam score is low

  1. Check SPF, DKIM and DMARC first. A failed check is the most common cause. Use the free SPF, DKIM and DMARC checkers.
  2. If they pass, look at the rules listed in the message's contentFlags: image-only emails, shouting subjects and link-stuffed bodies are common.

More on records in how to check SPF, DKIM and DMARC.

Related guides

Get private inboxes: the QuickInbox Business API has a free plan with 5,000 emails a month, and paid plans from $9. Create a free account or read the API docs.

← All articles