Email Testing

Test email going to spam? Work down this list

A test email going to spam is nearly always an authentication or sending-path problem. The likely causes in order, each with its fix and a way to prove it.

On this page
  1. 1. The staging domain has no SPF or DKIM
  2. 2. Mail is going direct to MX from a dev box or CI runner
  3. 3. The From domain does not align
  4. 4. The message itself looks like a test
  5. 5. A new subdomain plus bursty CI volume
  6. 6. Prove it instead of reading the spam folder
  7. 7. What a test inbox cannot tell you

A test email going to spam is nearly always a sending-path problem, not a wording problem. Work down this list in order, because the first two causes account for most of it: the sending domain is not authenticated, the mail left a machine nobody vouches for, the From domain does not align with DMARC, the message is structurally odd, or the domain is far too new for the volume your CI job is producing. Rewriting the subject line is the last thing to try, not the first.

Everything below assumes you can see the message as it arrived, headers included. If your only evidence is “it was in the spam folder”, you are guessing.

1. The staging domain has no SPF or DKIM

This is the most common cause by a wide margin. Production sends through an ESP that somebody set up properly a year ago; staging sends through a second account, a different subdomain, or a local relay nobody ever published records for.

Google’s sender guidelines require SPF or DKIM for every sender, not only bulk ones. Fail both and you are in the pile that gets filtered on sight.

The fix is to publish an SPF record covering the staging relay and to enable DKIM signing on it, then confirm from a received message rather than from a DNS lookup. DNS tells you what you published. The message tells you what the receiver actually computed.

2. Mail is going direct to MX from a dev box or CI runner

sendmail, PHP’s mail(), or a Nodemailer transport pointed straight at the recipient’s MX all put your message on whatever IP the machine happens to have. On a laptop that is a residential range. On a CI runner it is a shared cloud IP with no reverse DNS and a history you did not write. Both get filtered hard, and neither is worth debugging.

Route staging and CI through the same kind of relay production uses, even if it is a separate account with the same provider. If you are wiring this up in Node, the transport choice matters far more than the code around it, which is covered in sending test mail with Nodemailer.

3. The From domain does not align

Alignment is the rule people miss. DMARC does not care that SPF passed; it cares that the domain which passed is the same domain shown in the visible From: header. Staging that sends as noreply@example.com through a relay signing as d=relay-vendor.net passes DKIM and still fails DMARC, because the two identifiers do not match.

If example.com publishes p=quarantine or p=reject, that failure is an instruction to the receiving server to treat your mail as spam. A stricter policy makes a misconfigured staging environment look worse, not better.

Fix it by signing with a domain you control, or by giving staging its own authenticated subdomain such as staging.example.com and letting it send as itself. A test email going to spam because it was impersonating production is an alignment bug with a one-record fix.

4. The message itself looks like a test

Content is real but secondary, and it bites hardest when authentication is already weak. The usual offenders in a test build:

  • A body of TEST TEST TEST or lorem ipsum with one bare link.
  • HTML only, with no text/plain alternative part.
  • Links pointing at http://localhost:3000 or a raw IP address, which no legitimate mail does.
  • One large image and almost no text.

Send the real template with realistic data, keep the multipart alternative, and rewrite links to a routable staging host. That is the same class of problem covered in why emails land in the spam folder, triggered by a fixture instead of a campaign.

5. A new subdomain plus bursty CI volume

A subdomain created last Tuesday has no reputation. Point a CI suite at it that fires two hundred signup emails an hour, all to the same two seed addresses, and you have built something shaped like a list test. Even correctly authenticated mail gets throttled or filtered under that pattern.

The durable fix is not warming the domain. It is not sending CI mail to real mailbox providers at all. Provider filtering is a moving target you do not control, and a build should never go red because somebody else changed a threshold overnight.

6. Prove it instead of reading the spam folder

Send the test to an inbox that hands you the authentication results directly. InboxDome creates a receive-only test inbox in one API call, waits for the message, and reports what SPF, DKIM and DMARC actually evaluated to, so you can see which of the causes above is live.

const run = await client.assertEmail(
  inbox.id,
  [
    { type: 'auth', check: 'spf', expect: 'pass' },
    { type: 'auth', check: 'dkim', expect: 'pass' },
    { type: 'auth', check: 'dmarc', expect: 'pass' },
    { type: 'containsText', text: 'Confirm your address' },
  ],
  { timeoutSeconds: 45 },
);

console.log(run.passed, run.arrivalSeconds, run.results);

assertEmail never throws on a failed assertion, so read run.results to see which check failed rather than only that something did. For a one-off look, fetch the message and print detail.authResults, which carries the spf, dkim and dmarc verdicts for that message. Wire the same call into a pipeline with the Email Testing API for CI and QA, or read the endpoints in the InboxDome API reference. The free tier covers 100 inbox tests a month, enough for an authentication check on every deploy. If the sender is a WordPress install, start with fixing WordPress mail that never arrives instead, because wp_mail often is not going through your relay at all.

7. What a test inbox cannot tell you

Be clear about the limits. InboxDome is receive-only and does not run Gmail’s or Outlook’s filter, so it cannot give you a spam score or tell you which folder a real recipient would have seen. It answers narrower questions: did the message arrive, how long did it take, what did it contain, and did authentication pass.

Those cover the causes of a test email going to spam that you can actually fix in code and DNS. For true inbox placement you still need seed accounts at the providers you care about, reviewed by a human on a schedule rather than on every commit. Use both, and keep the deterministic one in CI.

Disclosure: InboxDome publishes this blog and makes the products it mentions. We describe what they do rather than promise results.

Key takeaways

  • Check authentication first: SPF, DKIM and DMARC explain most filtered test mail, and content explains very little of it.
  • Staging that sends as the production From address usually fails DMARC alignment, which is worse than having no policy at all.
  • Sending direct to MX from a laptop or a CI runner puts your mail on an IP with no reputation and often no reverse DNS.
  • A receive-only test inbox proves arrival, timing and SPF/DKIM/DMARC results, but it cannot tell you where Gmail would file the message.
  • Keep CI mail off real mailbox providers entirely, so a filtering decision can never turn a green build red.

Sources

  1. Google: Email sender guidelines — Requires SPF or DKIM for all senders, and From alignment with the SPF or DKIM domain.
  2. RFC 7489, Domain-based Message Authentication, Reporting and Conformance — Defines identifier alignment and what a receiver does with a failing message.
  3. RFC 7208, Sender Policy Framework

Links last checked September 7, 2026.

Frequently asked questions

Why does my test email go to spam when production mail is fine?

Almost always alignment. Staging usually sends through a different relay or subdomain than production, so the From domain no longer matches the SPF or DKIM domain and DMARC fails even though the copy is identical.

Does sending to a temporary email address cause spam filtering?

No. A disposable address is a normal mailbox that accepts mail over SMTP, and it has no spam folder to file into. A message either arrives or it does not, which is what makes it useful for testing.

Can I get a spam score before I send anything?

Content scoring tools exist, but they guess. The checks that decide placement at the large providers are authentication, sending-IP history and recipient behaviour, and none of those can be measured from the message body alone.

Should CI tests send to a real Gmail account?

Only for a deliberate placement check that a human reviews. In automated runs it makes tests depend on filtering rules you do not control, and a message filed as spam still counts as delivered, so the assertion proves nothing.

InboxDome TeamEmail infrastructure builders

The InboxDome team runs the temporary-email service and email-testing API this blog belongs to. We write about disposable inboxes, email privacy and testing transactional email, based on operating the infrastructure ourselves.