Home / Guides / Authentication

Reverse DNS (PTR) records for mail servers

What a PTR record is, why Gmail and other inboxes insist on matching forward and reverse DNS, and how to get it set correctly for your sending IP.

7 min read · Updated 27 October 2026 · By the dijitul team

A reverse DNS (PTR) record maps an IP address back to a hostname. For a mail server it is not optional: Gmail requires valid forward and reverse DNS for every sender, and most other providers treat a missing or generic PTR as a strong spam signal. The catch is that you usually cannot set it in your own DNS. It is set by whoever owns the IP address.

What a PTR record actually is

Normal DNS goes forwards: you look up mail.example.co.uk and get an IP address back. Reverse DNS goes the other way: a receiving server sees a connection from 203.0.113.25 and asks "what name belongs to this address?"

The answer lives in a special zone. For IPv4, the address is written backwards under in-addr.arpa:

25.113.0.203.in-addr.arpa.  3600  IN  PTR  mail.example.co.uk.

When your server connects to Gmail or Outlook, the first thing the receiver learns is your IP. Before it has read a single header, it can look up the PTR and decide whether you look like a properly run mail server or a compromised home broadband router.

Forward-confirmed reverse DNS (FCrDNS)

A PTR on its own proves little, because the owner of an IP can point it at any name, including a name they do not own. So receivers check both directions:

  1. Look up the PTR for the connecting IP: 203.0.113.25 gives mail.example.co.uk.
  2. Look up the A record for that hostname: mail.example.co.uk gives 203.0.113.25.
  3. If the two match, the IP has forward-confirmed reverse DNS.

This is what Gmail means by "valid forward and reverse DNS". The PTR must exist, the hostname it returns must resolve, and it must resolve back to the same IP. If step two returns a different address, or nothing at all, the check fails.

; In the reverse zone (set by the IP owner)
25.113.0.203.in-addr.arpa.  IN  PTR  mail.example.co.uk.

; In your own zone for example.co.uk (set by you)
mail.example.co.uk.         IN  A    203.0.113.25

Who sets the PTR record

This trips up almost everyone. Your domain's DNS host (Cloudflare, your registrar, your web host's nameservers) controls records for example.co.uk. It does not control the reverse zone for 203.0.113.x. That belongs to the organisation the IP block was allocated to.

Where you send fromWho sets the PTRHow
VPS or cloud serverYour cloud providerUsually a "reverse DNS" field next to the IP in the control panel. Some providers only allow it once the matching A record exists.
Dedicated server or managed hostingYour hosting companySupport ticket or control panel setting.
Office server on a business lineYour ISPRequest it from the ISP. Many only offer this on static IP business connections.
Dedicated IP from an email platformThe platformNormally set for you, sometimes as a custom hostname on your domain.
Google Workspace, Microsoft 365, shared IPs on email platformsThe providerNothing to do. Their IPs already have correct PTRs.
If you send through Google Workspace, Microsoft 365 or a mainstream email platform on shared IPs, PTR records are already handled. Focus on SPF, DKIM and DMARC instead. This guide matters most if you run your own mail server, a VPS sending website mail, or a dedicated IP.

Generic versus descriptive hostnames

Having a PTR is not enough if it looks like a consumer connection. Many providers assign a default PTR that encodes the IP address:

25.113.0.203.in-addr.arpa.  IN  PTR  203-0-113-25.dynamic.example-isp.net.

Spam filters have long treated hostnames containing the IP digits, or words like dynamic, dhcp, pool, dsl or cable, as a sign of a residential connection, which is where a lot of botnet spam comes from. Some blacklists list such ranges outright. Even when the forward lookup matches, a generic name costs you reputation.

A good mail server PTR is:

  • A hostname on a domain you control, such as mail.example.co.uk or mx1.example.co.uk.
  • Free of the IP address digits and of words that suggest a dynamic or residential line.
  • Backed by an A record (or AAAA for IPv6) pointing to the same IP.
  • One name per IP. Multiple PTR records for a single address confuse some receivers; keep it to one.

The PTR hostname does not need to match the domain in your From address. A server at mail.example.co.uk can happily send for other domains, which is how shared hosting works. Alignment between the visible From domain and the sender is handled by DKIM and DMARC, not by reverse DNS.

Check your setup now: run a free test at mail-tester.co.uk and see your score in seconds.

Matching the HELO name

When your server opens an SMTP connection it introduces itself with HELO or EHLO followed by a hostname. Receivers compare that name to the PTR. Best practice is for all three to agree:

  • HELO/EHLO name: mail.example.co.uk
  • PTR for the sending IP: mail.example.co.uk
  • A record for mail.example.co.uk: the sending IP

A server that announces itself as localhost, a bare IP, or an internal name like server01.local picks up penalties in spam scoring. In Postfix the setting is myhostname; in Exim it is primary_hostname; Plesk and cPanel servers usually take it from the server hostname, which you should set to a real, resolvable name before going live.

# /etc/postfix/main.cf
myhostname = mail.example.co.uk
smtp_helo_name = $myhostname
Managed UK hostingdijihostManaged UK hosting with Plesk, Cloudflare DNS, daily backups and a domain included, for £1 a day + VAT. Old sites welcome.Host with dijihost

IPv6 and reverse DNS

If your server has an IPv6 address and the receiver supports IPv6, your mail may well leave over IPv6 without you realising. Every IPv6 address you send from needs its own PTR, written nibble by nibble in reverse under ip6.arpa:

; 2001:db8:10::25
5.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.8.b.d.0.1.0.0.2.ip6.arpa.  IN  PTR  mail.example.co.uk.

mail.example.co.uk.  IN  AAAA  2001:db8:10::25

Receivers tend to be less forgiving on IPv6 because there are so many addresses that IP-based reputation is harder to build. If you cannot get a PTR set for your IPv6 address, the safer option is to make your mail server send over IPv4 only (in Postfix, inet_protocols = ipv4) until you can. Remember to include the IPv6 address in your SPF record if you do send over it.

How to check your reverse DNS

First, find the IP your mail actually leaves from. The easiest way is to send a message to Mail Tester UK and read the result, which shows the connecting IP and whether its reverse DNS checks out. You can also look at the earliest Received: header added by the receiving server in any message you have sent to yourself at Gmail.

With dig (macOS, Linux)

$ dig -x 203.0.113.25 +short
mail.example.co.uk.

$ dig mail.example.co.uk A +short
203.0.113.25

Both answers line up, so this IP has forward-confirmed reverse DNS.

With nslookup (Windows)

C:\> nslookup 203.0.113.25
Name:    mail.example.co.uk
Address: 203.0.113.25

C:\> nslookup mail.example.co.uk
Name:    mail.example.co.uk
Address: 203.0.113.25

For IPv6, dig -x 2001:db8:10::25 builds the ip6.arpa query for you.

Common problems and fixes

SymptomCauseFix
No PTR returnedIP owner has not set oneAsk your host or ISP to set it to your mail hostname.
PTR returns the provider's generic nameDefault PTR never changedCreate an A record for mail.example.co.uk, then ask for the PTR to be changed to it.
PTR is right but forward lookup failsMissing or wrong A record in your zoneAdd or correct the A record at your DNS host.
Passes on IPv4, fails on some receiversMail leaving over IPv6 with no PTRSet an IPv6 PTR or force IPv4 sending.
Rejected with "IP not authorised" type messagesSending from a residential IPRelay through your hosting provider or an email platform instead.
Changing a PTR does not repair a damaged reputation overnight. If your IP is already listed on blacklists because of a generic PTR or past abuse, fix the DNS first, then work through the blacklist removal process.

The short version

Pick a hostname such as mail.example.co.uk, point its A record at your sending IP, ask the IP owner to set the PTR to that same name, configure your mail server to use it as its HELO name, and do the same for IPv6 if you send over it. Then test. It is a ten-minute job that removes one of the most basic reasons mail gets rejected, and it is a hard requirement under the Gmail and Yahoo sender rules.

Frequently asked questions

Can I add a PTR record in my DNS control panel?

Usually not. PTR records live in the reverse zone for the IP address, which is controlled by whoever owns the IP: your hosting provider, cloud provider or ISP. Ask them, or look for a reverse DNS setting in their control panel.

What is forward-confirmed reverse DNS?

It means the IP address has a PTR record pointing to a hostname, and that hostname has an A (or AAAA) record pointing back to the same IP. Receivers check both directions match.

Does Gmail require reverse DNS?

Yes. Gmail requires every sender to have valid forward and reverse DNS for the sending IP. Without it, mail is likely to be rejected or sent to spam.

Do I need to worry about PTR records if I use Google Workspace or Microsoft 365?

No. When your mail is sent through Google, Microsoft or a reputable email platform, it leaves from their IP addresses and they manage the PTR records. It matters when you run your own mail server or send from your own VPS or dedicated IP.

Do IPv6 mail servers need reverse DNS?

Yes, and receivers are often stricter about it on IPv6. Every IPv6 address you send from needs its own PTR record in the ip6.arpa zone with a matching AAAA record.

From the team behind Mail Tester UK

More from dijitul