What the message looks like
warning: hostname mail.example.net does not resolve to address 203.0.113.25: Name or service not knownCommon causes
- The sender's PTR points to a name without a matching A or AAAA record.
- Typical for spam bots and residential lines – then the warning is expected.
- Your own server: PTR set at the hoster, but the A record is missing or points elsewhere.
- IPv6 connection while only an IPv4 reverse entry exists.
- The local resolver returns stale answers or none at all.
Check
- Look up the PTR of the connecting IP
- Check that the name points back to the same IP
dig +short A mail.example.net; dig +short AAAA mail.example.net - Count the most frequent IPs in the log
grep 'does not resolve to address' /var/log/mail.log | awk '{print $NF}' | sort | uniq -c | sort -rn | head - Check whether strict hostname checks are enabled
postconf smtpd_client_restrictions smtpd_recipient_restrictions | grep -o 'reject_unknown[a-z_]*'
Fix
- If it concerns foreign IPs, the warning is normal and can be ignored.
- If it is your own server: set the PTR at your provider and create an A or AAAA record with exactly that IP.
- Prefer
reject_unknown_reverse_client_hostnameoverreject_unknown_client_hostname– the strict one also hits legitimate servers. - For IPv6 sending set a PTR for the IPv6 address, or send over IPv4 only (
smtp_address_preference = ipv4).
Typical scenario
The mail log of a Postfix server fills with lines such as 'warning: hostname mail.example.net does not resolve to address 203.0.113.25: Name or service not known'. A business partner reports that some of his mails are being rejected. Postfix found the PTR name of the IP, but the A record for that name points to another address or does not exist. Compare dig -x 203.0.113.25 +short with dig +short mail.example.net; both directions have to agree.
FAQ
Is mail rejected because of this warning?
No, the warning alone rejects nothing. Mail is only rejected if you set reject_unknown_client_hostname – then with 450 4.7.25.
Is this a problem with Gmail or Microsoft?
For your own outgoing mail, yes: large providers expect matching forward and reverse DNS and otherwise file the mail as spam or reject it.
Is the warning a problem on its own?
No, Postfix only logs it and treats the client as 'unknown'. Rejection happens only when a rule such as reject_unknown_client_hostname or reject_unknown_reverse_client_hostname is active. Then 'cannot find your hostname' appears as well.
Why do I see the message for my own staff too?
Mobile devices and home connections often have generic PTR names at the provider that do not resolve back. Authenticated users are not held up by it. The rule therefore belongs only in the part of the ruleset that applies to unauthenticated clients.
Does this affect my outgoing mail as well?
The warning concerns incoming connections. For outgoing mail, other servers run the same check on you: the IP needs a PTR pointing to your mail name, and that name has to resolve back to the IP. If it does not, spam scoring and rejections rise.