About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
When Postfix cannot resolve a host while handling mail, dns_lookup.c builds this sentence into the failure reason:
Host or domain name not found. Name service error for name=%s type=%s: %s
The three fields are the name it looked up, the record type, and the resolver's own error text. The line is a DNS failure inside Postfix's resolver code. It is a different text from the SMTP reply 450 4.1.8 Sender address rejected: Domain not found, which smtpd_check.c builds for reject_unknown_sender_domain, and it is not a full disk.
What happens to the mail depends on the kind of failure. In smtp_addr.c at tag v3.9.1, a temporary lookup failure (DNS_RETRY) sets the status 4.4.3, and the message stays queued. A name that does not exist (DNS_NOTFOUND) sets 5.4.4 at lines 223-224, a permanent status unless a temporary failure for the same destination is already recorded (SMTP_HAS_SOFT_DSN), and a hard resolver failure (DNS_FAIL) sets 5.4.3 on the same rule at line 215. A permanent status is not a deferral: that message is not left waiting in the queue, and the sentence appears in the bounce or in the mail log. postqueue(1) says that if mail could not be delivered on the last attempt, the reason is shown in the queue listing, so postqueue -p shows this sentence only for mail still queued.
What the symptom means
The string is written when the resolver's h_errno is not zero. The source then classifies it:
NO_RECOVERYreturns a hard DNS failure.HOST_NOT_FOUNDandNO_DATAreturn "not found", unless the caller asked the lookup to keep the not-found answer (keep_notfoundin the source).- Any other resolver error returns a retry.
So the same sentence covers a name that does not exist and a lookup that failed for another reason. The last %s is how you tell them apart. Read it. Do not stop at "name not found" if the resolver text says the server did not answer.
The type field is whatever record type Postfix asked for in that lookup. Read it together with the name: the same name can fail for one type and succeed for another.
DEBUG_README describes a warning: as a non-fatal error. It may be a broken DNS server elsewhere, or a local configuration error. An error: is an error condition. A fatal: means Postfix cannot proceed until you fix missing files, permissions, or configuration.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| The name has no such record | The resolver text is a not-found error, and dig agrees | dig the name and type from the log, on the mail server |
| The mail server's resolver cannot reach DNS | The same sentence, and dig on that host times out or fails while dig from elsewhere works | Compare the two lookups |
| The MX hostname does not exist | type=MX succeeds, and a later line names a host with no address |
Look up each exchanger |
| The mail server's resolver answers differently from the authoritative server | The record exists at the authoritative server, and the mail server still reports not found | Query the authoritative server with dig @server name type, then the mail server's own resolver |
| The domain is misspelled in the recipient address | The name in the log is not the domain you meant | Compare the queued sender and recipient with the name in the error |
Prove the cause before changing anything
All of these are read-only.
1. List the queue and read the reason. postqueue(1) lists the queue with -p. Each entry shows the queue file ID, size, arrival time, sender, and the recipients still to be delivered. The reason is included when the last attempt failed.
postqueue -p
If the message is not listed, it may already have been returned to the sender. Look for the sentence in the bounce message or in the mail log.
Copy the name, the type, and the text after the last colon.
2. Look up that name and type on the mail server. The dig manual's synopsis takes a name and a type, [name] [type], so a lookup of the type MX for a name is:
dig example.com MX
The manual says that when no type is given dig looks up an A record, and its terse example is dig +short example.com. Use the name and the type from the log. +short gives a terse answer, and the default is the verbose form. Run the same lookup once without +short so you see the full reply. An empty short answer does not say whether the name is missing or the query failed.
3. Ask a specific server if you suspect cache or delegation. The manual's form is dig @server name type, and its example queries the name server f.gtld-servers.net for example.com. Point @ at the domain's authoritative server, and add the type from the log. If that server has the record and the mail server does not, the mail server's resolver or cache is the fault.
4. Scan the log for the first problem. The source builds the sentence into the failure reason, so also search the mail log for Name service error. For the other messages around it, DEBUG_README gives:
grep -E '(warning|error|fatal|panic):' /some/log/file
It says the important message is near the beginning of that output. Replace /some/log/file with the mail log path on this host. The readme says syslog logging usually uses /var/log/maillog or /var/log/mail, and that the path is set in the syslog configuration. It also says you can find the Postfix configuration directory with postconf config_directory.
Fix
The repair is in the DNS the log named. If the name should exist and you publish the zone, the missing record has to be added in the steps below. If the name is wrong in the message, the recipient has to be corrected. Changing Postfix to skip DNS does not make a missing host appear.
Save the queue reason and the dig answer before you edit DNS. Run these two commands, using the name and type from the log. Each answer goes to its own file:
postqueue -p > queue-before.txt
dig <name-from-log> <type-from-log> > dig-before.txt
Also copy the record for that name and type from the DNS console, if one exists, into console-before.txt. An empty console-before.txt means no such record existed before the change.
Risk: the next step adds or changes an MX or an address record. Mail for that domain then goes to the host you name. A wrong address delivers mail to the wrong server. Deleting the only MX stops mail for the domain.
In the DNS console for the zone that is actually delegated, add or correct the record for the name and type in the log. Then run the same dig query from the Postfix server.
To undo it: if console-before.txt holds a record, put that record back. If it is empty, delete only the record you added. Then query again from the Postfix server.
If dig against the authoritative server succeeds and dig on the Postfix server still fails, the zone is not the thing to edit. The resolver that Postfix uses is. DEBUG_README treats a warning like this as possibly a broken DNS server elsewhere, or a local configuration error. The resolver configuration on the mail server is then the thing to repair, and main.cf is not.
Do not run postqueue -f while you are testing one domain. postqueue(1) warns that flushing undeliverable mail frequently gives poor delivery of all other mail.
Example (illustrative): the queue reason says name=mail.example.net type=A and the resolver text is a not-found error. dig mail.example.net A on the Postfix server returns no address. The MX for example.net is mail.example.net. The administrator adds an A record for mail.example.net in the zone that the parent delegates, confirms it from the Postfix server, and then waits for the next delivery attempt.
Confirm the fix
- The same dig query from the Postfix server returns the record you expect.
- For mail that was deferred after a temporary lookup failure,
postqueue -pno longer shows that recipient with this name-service reason after the next delivery attempt. For a recipient domain whose name did not exist, the original message was already returned to the sender with a permanent status, so the confirmation is that a new message to the recipient is delivered. - If you do not want to wait for the next delivery attempt, you can have one queued message tried now. First show the exact message you are about to retry. Run
postqueue -p, find the entry for the recipient and the name in the log, and read its queue ID, which is the first field of the entry. A queue ID looks like4F2A81B3C1.
Disruptive step: the next command makes Postfix attempt delivery of that one queued message immediately, to the real recipient. A delivery that succeeds cannot be recalled or undone. A failed attempt after a temporary lookup failure leaves the message queued. Run it only when the dig query from the Postfix server already returns the record you expect.
postqueue(1) schedules the attempt with -i and the queue ID:
postqueue -i <queue-ID>
There is no back-out for a delivered message. If you chose the wrong queue ID, stop and check the listing again before you run any further command.
What to watch afterwards
- A name that disappears from DNS will queue mail again with the same sentence. Keep the name and type from the first incident so the second one is familiar.
- After you add a record, query the authoritative server to see whether the zone is already correct, then query from the mail server.
- If several unrelated domains fail this way at once, check the resolver on the mail server as well as each domain's DNS.
Read next
Related articles you may want next.
- TroubleshootingPostfix 450 4.1.8: Sender address rejected, domain not foundPostfix rejected the sender address with 450 4.1.8 Domain not found. Check the sender domain's MX and address records, and the unknown_address_reject_code default of 450.Read article
- TroubleshootingPostfix mail stuck in the queue as deferred: read the reasonPostfix mail stuck as deferred? Read the reason in postqueue -p and the mail log, group by destination with qshape, fix the cause, then flush once.Read article
- Troubleshooting"Temporary failure in name resolution" on a Linux server: test each layer from systemd-resolved downLinux says Temporary failure in name resolution? Test getent, resolvectl and the upstream with dig, then fix resolved, netplan or NetworkManager DNS.Read article
Risks and limits
- The sentence is a format string. The last field depends on the system resolver, so two servers can word the same failure differently.
HOST_NOT_FOUNDand a temporary server failure share the opening words. The classification indns_lookup.cis not printed as a separate token. Use the resolver text and a second dig.postqueue -iattempts delivery. It is not a way to delete mail.
Sources
- dns_lookup.c — Postfix tag v3.9.1, no date shown, accessed 22 November 2026
- postqueue(1) — Postfix, no date shown, accessed 22 November 2026
- Postfix Debugging Howto — Postfix, no date shown, accessed 22 November 2026
- smtp_addr.c — Postfix tag v3.9.1, no date shown, accessed 22 November 2026
- smtpd_check.c — Postfix tag v3.9.1, no date shown, accessed 22 November 2026
- BIND 9 manual pages: dig, version 9.20.22 — ISC, no date shown, accessed 22 November 2026
This article was originally published on .