Qvantor logo QvantorInfrastructure, explained plainly
Email Infrastructure

PTR Record for a Mail Server and Why Reverse DNS Matters

Your mail server sends a message, and Gmail or Outlook either rejects it outright or quietly files it as spam, even though SPF and DKIM pass.

Rack mounted server with blinking network lights beside a laptop showing a terminal with DNS lookup results

Your mail server sends a message, and Gmail or Outlook either rejects it outright or quietly files it as spam, even though SPF and DKIM pass. Very often the missing piece is a PTR record, the reverse DNS entry that maps your sending IP address back to a hostname. Receiving servers check it within the first second of the SMTP conversation, long before they look at your content.

This guide explains what a PTR record does for a mail server, who actually controls it, how to set one up correctly and how to test it from your own terminal. It assumes you run Postfix, Exim or a similar MTA on a VPS or a dedicated box with a static IPv4 address.

What a PTR record is and why mail servers check it

Normal DNS answers the question "which IP does mail.yourdomain.com live at?" with an A record. A PTR record answers the reverse question: "which hostname owns 203.0.113.25?" It lives in a special zone, in-addr.arpa for IPv4, where the octets are written backwards. The lookup for 203.0.113.25 is actually a query for 25.113.0.203.in-addr.arpa.

When your server connects to a receiver on port 25, the receiver sees only your IP. Before accepting anything, many receivers run a forward confirmed reverse DNS check, usually shortened to FCrDNS:

  1. Look up the PTR record for the connecting IP and get a hostname.
  2. Look up the A record for that hostname.
  3. Confirm that the A record points back to the same IP.

If step 1 returns nothing, or step 3 fails, the receiver treats the connection as coming from an unmanaged machine, the kind of host that sends most botnet spam. Gmail's sender guidelines have required a valid PTR for all senders since 2024, and Microsoft's consumer mail filters behave much the same way. Smaller providers often reject with a 550 code and a message like "Client host rejected: cannot find your hostname".

Who controls the PTR record (it is probably not you)

This is the part that trips people up. You control the DNS zone for your domain, so you can create A, MX and TXT records whenever you want. But the in-addr.arpa zone for an IP belongs to whoever owns the IP block, which is your hosting provider or ISP.

That means you set the PTR through your provider, not your domain registrar:

  • Hetzner, DigitalOcean, Vultr, Linode: there is a reverse DNS field in the server or IP panel. On DigitalOcean the PTR is set automatically from the droplet name, so you name the droplet mail.yourdomain.com.
  • AWS EC2: you attach an Elastic IP and submit a reverse DNS request through the console. AWS also requires you to request removal of the port 25 sending limit separately.
  • Residential ISPs: most will not set a custom PTR at all, and their dynamic IP ranges sit on blocklists like Spamhaus PBL. Self hosted mail from a home connection usually needs a relay or a cheap VPS for outbound traffic.

Changes on most VPS panels take effect within 5 to 30 minutes, although cached negative answers can linger for up to an hour depending on the zone's SOA settings.

How to set up a PTR record for your mail server step by step

The goal is three records that agree with each other. Here is the sequence I use on every new mail host.

1. Pick the hostname

Choose a stable, boring name such as mail.yourdomain.com. Avoid names that look generated, like vps-203-0-113-25.provider.net, because some filters score those as generic and treat them the same as a missing record.

2. Create the forward A record

In your own DNS zone, add an A record: mail.yourdomain.com pointing to 203.0.113.25. If the server also sends over IPv6, add an AAAA record for its address.

3. Set the PTR at your provider

In the provider panel, set the reverse DNS for 203.0.113.25 to mail.yourdomain.com. Do the same for the IPv6 address if Postfix is allowed to send over it. A surprisingly common failure is a perfect IPv4 PTR while the server silently delivers over IPv6, which has no PTR at all.

4. Match the SMTP greeting

Set your MTA's hostname to the same name. In Postfix that is myhostname = mail.yourdomain.com in main.cf, then reload. The HELO or EHLO name your server announces should resolve and match the PTR. It is not strictly required, but mismatches add spam score at several large receivers.

Testing reverse DNS from the command line

You do not need a web tool for this. From any Linux or macOS machine:

  • dig -x 203.0.113.25 +short should return mail.yourdomain.com. with a trailing dot.
  • dig mail.yourdomain.com A +short should return 203.0.113.25.
  • dig -x on your IPv6 address should also return a name if you send over IPv6.

Then check what your server actually announces. Send a test message to a mailbox you control and open the raw source. The topmost Received header written by the receiving server shows the PTR name it saw and the HELO name you sent. Our guide on reading email headers to trace a delivery problem walks through that header line by line.

If the receiver shows "unknown" in place of a hostname, the PTR lookup failed from their side, even if it works from your laptop. Wait 30 minutes and test again before changing anything.

The advice I disagree with: one PTR per sending domain

A lot of setup guides tell you the PTR must match the domain in your From address. People then try to put five domains on one IP and get stuck, because an IP can realistically hold only one PTR name. Some even add multiple PTR records, which makes resolvers return them in random order and breaks FCrDNS half the time.

The PTR identifies the server, not the brand. Receivers check that the machine is managed and consistent. Domain alignment for the visible From address is the job of SPF, DKIM and DMARC. A single server named mail.hostingco.net can legitimately send for clientone.com and clienttwo.org, as long as each of those domains publishes SPF that includes the IP and signs with its own DKIM key. This is exactly how every large email provider operates. If you want the full picture of how those three records divide the work, see why email authentication records still confuse website owners.

So: one IP, one PTR, one hostname, as many domains as your authentication records cover.

Common PTR mistakes and what they look like

SymptomLikely causeFix
550 cannot find your hostnameNo PTR set at the providerSet reverse DNS in the hosting panel
PTR resolves but receivers still complainA record missing or points elsewhereCreate a matching A record
Works for some recipients, fails for GmailMail leaving over IPv6 with no PTRAdd IPv6 PTR or set inet_protocols = ipv4
Spam folder, no bounceGeneric PTR name from the providerReplace with a descriptive hostname

Fixing reverse DNS will not rescue a server whose IP sits on a blocklist or whose content looks like spam. It removes one of the first and cheapest reasons for rejection, which lets the rest of your setup be judged on its merits. For what happens after that first check, our explainer on how email deliverability works and why messages land in spam covers reputation and content filtering.

Frequently asked questions

Do I need a PTR record if I send through a service like Amazon SES or Postmark?

No. When a relay service delivers your mail, the connection comes from their IPs, and they manage the PTR records for those addresses. You only need your own PTR when your server talks directly to recipients on port 25.

Can a PTR record point to a different domain than my website?

Yes. The PTR only needs to name a hostname whose A record points back to the same IP. Many people use a separate infrastructure domain for mail servers so the website domain stays untouched.

How long does a PTR record change take to work?

Most VPS providers publish the change within 5 to 30 minutes. Receivers that cached a failed lookup may keep that result for up to an hour, so test with dig -x first and send real mail after the answer is correct.

IV
Ilkka Varis

Ilkka has run mail servers for small companies since the days of hand edited DNS zones.

More posts by Ilkka

More in Email Infrastructure

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto