# Tell every customer which DNS record is wrong

Your customers publish DNS for their own domains, and some of it goes wrong. Diagnostics reads their zone live and returns each problem as a finding that names the record, what is in its way and the exact change that fixes it.

[Get started](/signup)
[Documentation](https://docs.aiinbx.com/guides/domains#diagnostics)

Example: verifying mail.harbourly.com returns verified\_at: null with every record verified except DKIM, which is pending. Diagnostics on the same domain returns one breaking finding, record-doubled:DKIM: the DKIM value is published at aibx.\_domainkey.mail.harbourly.com.harbourly.com because the DNS panel appended the zone to a full name, and the fix is to set the record's name to just aibx.\_domainkey.mail. The finding's evidence is the record as read from the zone.

Diagnostics

## A live reading of the customer's zone

Diagnostics looks the domain's records up in DNS as they are now and reports what it finds. Nothing is stored, so every call reads the zone again.

Example: a minute after Harbourly deletes a duplicate DMARC record, the TXT lookup for \_dmarc.mail.harbourly.com has two answers. A caching resolver still returns both records until its TTL runs out. The zone's own nameserver returns the one record the customer just saved, and that is the answer diagnostics reads.

### Live lookups

A resolver keeps serving an old answer until its TTL runs out. Lookups ask the zone's own nameservers first, so a record the customer corrected a minute ago reads as it is now.

Example: diagnostics on rheinbau.de returns three findings, worst first. Breaking, dmarc-enforced-early: mail sent from this domain is being rejected right now. Risk, spf-lookups:rheinbau.de: the SPF record on rheinbau.de asks for too much work. Tip, dmarc-no-reports: nobody is collecting this domain's DMARC reports.

### [Findings](https://docs.aiinbx.com/guides/domains#diagnostics)

Findings come back worst first as breaking, risk or tip. Each carries a title, a detail, the fix and the records it was read from as evidence.

Example: mail.yourapp.com is verified. Its DNS records (DKIM as TXT, SPF as TXT, DMARC as TXT, Return path as MX, Inbound as MX) are all found; the inbound MX record is only needed for receiving.

### [Records](https://docs.aiinbx.com/guides/domains#the-records)

Adding a domain returns its five records, each with a purpose, type, name, value and TTL, and a state of pending, verified or missing.

Example: the zone file for mail.harbourly.com with two records outstanding. It holds the inbound MX record, under a comment saying it replaces 10 mx.oldhost.net and that record is to be deleted first, and the DKIM TXT record at aibx.\_domainkey.mail.harbourly.com.

### Zone file

In the console the outstanding records download as a zone file. It marks any record the customer has to delete first, since an import only adds.

Example: mail.harbourly.com sends domain.verified on 14 September once its DKIM key is found at the right name. On 3 February at 16:08 the key is deleted in a DNS clean-up and domain.at\_risk is sent while the domain keeps sending for 72 hours. At 17:40, after the record has been back and found by every check for an hour, domain.restored is sent.

### [Events](https://docs.aiinbx.com/guides/domains#staying-verified)

A domain whose DKIM key goes missing sends domain.at\_risk 72 hours before it stops sending.

Rules

## Why a customer's domain won't verify

Every rule diagnostics runs, grouped by the record a customer would edit, with the id and severity its finding comes back with.

### Any record

-   record-doubled:<purpose>, breaking: Published at the name with the domain on it twice, because the DNS panel appended the zone to a full name.

-   value-mangled:<purpose>, breaking: The right value with quotation marks stored around it, so it no longer matches character for character.

-   cname-conflict:<purpose>, breaking: A CNAME already sits at the name, and a name with an alias can hold nothing else.

### DKIM

-   dmarc-enforced-early, breaking: The domain's DMARC already says reject or quarantine while the key is not published, so mail is refused or filed as spam until it is.

### SPF

-   spf-multiple:<name>, breaking: Two SPF records on one name, so receivers give up on both. Breaking on the return path, a risk on the root domain.

-   spf-lookups:<name>, risk: More than ten DNS lookups in the record's own mechanisms, before counting what each include pulls in.

-   spf-open:<name>, risk: The record ends in +all, which lets any server send as the domain.

-   dmarc-strict-spf, risk: DMARC set to aspf=s, which refuses the bounces subdomain. Mail still passes on DKIM alone.

### DMARC

-   dmarc-multiple, breaking: More than one DMARC record, so receivers ignore all of them.

-   dmarc-invalid, risk: No p= tag, so the whole record is thrown away.

-   dmarc-no-reports, tip: No rua address, so nobody receives the aggregate reports.

### MX, for receiving

-   mx-precedence, breaking: Another MX at the same or a lower priority number, so mail goes there while our record reads verified.

-   mx-other-region, breaking: The MX points at our inbound in a different region from the one the domain is set up in.

-   mta-sts-mismatch, breaking: An MTA-STS policy in enforce mode that does not list our server. In testing mode it is a tip.

-   wildcard-cname, breaking: A wildcard CNAME at \*.domain, where a wildcard's MX has to go.

-   mx-foreign, risk: Another provider receives the domain's mail today, and publishing our MX moves it.

-   mta-sts-unreachable, risk: An MTA-STS record announces a policy file that nothing serves.

-   mx-backup, tip: Old mail servers left behind ours as backups.

### The zone

-   zone-missing, breaking: No nameservers answer for the domain, so it is unregistered, expired or only just delegated.

-   wildcard-zone, risk: A \* record answers for names nobody set up, so a missing record can read as a wrong one.

-   apex-keeps-mail, tip: Under a wildcard, the apex keeps receiving wherever it does today.

-   lookups-incomplete, tip: Some lookups did not answer in time, so the list may be short.

API

## A domain check in your onboarding flow

Create the domain and show the customer its records. When they press Check, verify it and return the findings for whatever is still pending.

Step 1, domains.create: the records to show the customer.

```
const domain = await aiinbx.domains.create({
  name: "mail.harbourly.com",
})

for (const record of domain.records ?? []) {
  show(record.purpose, record.type, record.name, record.value)
}
```

Step 2, domains.verify: when they press Check.

```
const domain = await aiinbx.domains.verify(domainId)

if (!domain.verified_at) {
  const { data } = await aiinbx.domains.diagnostics(domainId)
  return data.map(({ severity, title, fix }) => ({ severity, title, fix }))
}
```

Step 3, your webhook handler: live, and when it stops being.

```
if (event.type === "domain.verified") {
  await customers.markSendingReady(event.data.domain_id)
}
if (event.type === "domain.lost") {
  await customers.askToRestoreDns(event.data.domain_id)
}
```

Details

## The rest of how verification works

-   verified\_at: Set when the DKIM key verifies, which is what sending needs. SPF, DMARC and the inbound MX each carry a state of their own.
-   Pending, then missing: A record that is not found yet reads pending for 48 hours after the domain is added, and missing after that.
-   Return-path SPF: The SPF record goes on bounces.<domain>, so the root domain's own SPF stays as it is. Diagnostics still reads the root record and flags a duplicate or +all.
-   Inbound MX: Needed only to receive. It routes all mail for the name to AI Inbx, so a customer with inboxes on their domain publishes it on a subdomain such as mail.harbourly.com.
-   Regions: eu-central-1 or us-east-1, chosen per domain. The inbound and return-path MX records name the region, so it is picked before they are published.
-   Wildcard domains: Connect \*.yourapp.com once and each customer's subdomain is verified the moment it is created, with no records of its own.

FAQ

## Questions

-   Why is my domain not verifying? Usually because a record is published in the wrong shape rather than not at all: at a name with the domain on it twice, with quotation marks stored in the value, next to a CNAME, or beside a second SPF or DMARC record. The diagnostics endpoint looks for each of these in the live zone and returns the record it found and the change to make.
-   Can a domain have two SPF records? No. A name may hold one SPF record, and a receiver that finds two treats the check as failed rather than combining them. Keep one, move the include: parts of the other into it, and delete the extra. Diagnostics reports it as spf-multiple, with both records quoted.
-   Do I have to change the SPF record on my root domain? No. The SPF record AI Inbx asks for goes on the return-path subdomain, bounces.<domain>, so the root domain's SPF stays as it is. Diagnostics still reads it and flags a duplicate, more than ten lookups or +all as a risk, because those break the check for everything else that sends as the domain.
-   Why does a DNS checker show my record while verification says it is missing? Either the checker is reading a cached answer, or it found the value somewhere other than the exact name that is looked up. AI Inbx asks the zone's own nameservers first, so a record corrected a minute ago reads as it is now, and a value buried one zone deeper is reported as record-doubled.
-   How long does DNS verification take? Usually minutes and occasionally hours, depending on the DNS host. A record not found yet reads pending for 48 hours after the domain is added, and missing after that. Rather than polling POST /domains/{id}/verify in a tight loop, subscribe to the domain.verified webhook, which fires when the DKIM key verifies.
-   Does a verified domain mean SPF and DMARC are correct? No. verified\_at is set when the DKIM key verifies, which is what sending needs. It does not certify SPF, DMARC or the inbound MX record; each record carries its own state, and diagnostics reports what is wrong with the rest of the zone.

Keep reading

## More on building with email

[All solutions](/solutions)

-   [Send email APISend email from your domain or your users' own Gmail and Outlook with one API call. Opt-outs and pacing are checked first, and replies land on the thread.ThreadingMailboxesPacingSuppressions](/solutions/send-email-api)
-   [Inbound email APIReceive email in your app over an API. Point an MX record at AI Inbx or connect Gmail and Outlook, and every message arrives as a signed, parsed JSON webhook.ThreadingAttachmentsMailboxesWildcard domains](/solutions/inbound-email-api)
-   [Email open trackingTrack email opens and clicks per domain or per send. Apple privacy prefetches and security scanner clicks arrive flagged as bots, each with its reason.Threading](/solutions/email-open-tracking)

-   [Wildcard domainsOne domain, a subdomain per customer.](/features/wildcard-domains)

## Give your product an inbox. The hard parts are already handled.

[Get started](/signup)
