Skip to content

How to Fix Postfix Reverse DNS (rDNS) Failure

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix Postfix Reverse DNS (rDNS) Failure. We cover key concepts, practical examples, and best practices.

Postfix rejects incoming connections or outgoing mail is deferred because the sending server's reverse DNS (PTR record) does not match its HELO hostname — the PTR record is missing or points to the wrong domain.

The Problem

warning: hostname mx.other.com does not resolve to address 10.0.0.1: Name or service not known
connect from mx.other.com[10.0.0.1]: EHLO mail.other.com
reject: HELO/EHLO hostname mismatch

Step-by-Step Fix

Step 1: Check current PTR record

dig -x 192.0.2.1
host 192.0.2.1

Step 2: Set the HELO hostname

# /etc/postfix/main.cf
myhostname = mail.example.com
smtp_helo_name = $myhostname

Step 3: Configure Postfix rDNS checking

# /etc/postfix/main.cf

# Reject if no PTR record
smtpd_recipient_restrictions =
    permit_mynetworks
    reject_unknown_reverse_client_hostname
    reject_unknown_client_hostname
    permit

# Reject if HELO doesn't match forward-confirmed rDNS
smtpd_helo_required = yes
smtpd_helo_restrictions =
    reject_invalid_helo_hostname
    reject_non_fqdn_helo_hostname
    check_helo_access hash:/etc/postfix/helo_access

Step 4: Create HELO whitelist

# /etc/postfix/helo_access
mail.example.com OK
mail.trusted.com OK

sudo postmap /etc/postfix/helo_access

Step 5: Request PTR record from ISP

# Contact your ISP or hosting provider to set:
# 192.0.2.1 PTR mail.example.com

Step 6: Test rDNS

host 192.0.2.1
# Should return: 1.2.0.192.in-addr.arpa domain name pointer mail.example.com

Prevention Tips

  • Always ensure PTR records match the HELO hostname
  • Set up FCrDNS (Forward Confirmed rDNS) for each mail server
  • Monitor rDNS compliance with email testing tools
  • Use a HELO hostname that matches the PTR record exactly

Common Mistakes with rdns fail

  1. Mixing let bindings with <- bindings in do notation, producing type errors
  2. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  3. Non-exhaustive pattern matches that compile with warnings then crash at runtime

These mistakes appear frequently in real-world POSTFIX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does Postfix reject connections based on rDNS?

Many mail servers reject connections from servers without valid rDNS to prevent spam. The sending IP must have a PTR record, and the hostname in that PTR record must match the HELO/EHLO hostname (Forward Confirmed rDNS).

How do I set up Forward Confirmed rDNS (FCrDNS)?

Set the PTR record for your mail server IP to match its hostname (e.g., mail.example.com). Ensure the HELO hostname in Postfix's myhostname matches. Verify with: host IP returns the hostname, and host hostname returns the original IP.

What happens if my mail server has no PTR record?

Many receiving mail servers reject or spam-filter emails from servers without PTR records. Postfix itself can also be configured to reject incoming connections from servers without rDNS: set reject_unknown_reverse_client_hostname in smtpd_recipient_restrictions.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro