Fix Reverse DNS (PTR) So Gmail Accepts Your Server's Mail
Running your own mail server? Gmail wants a PTR record that matches your A record. Learn to test it with dig, who can change it, and what to ask your host.
The short answer
Gmail asks every sender to have valid forward and reverse DNS: the sending IP needs a PTR record that returns a hostname, and that hostname needs an A or AAAA record pointing back to the same IP. The PTR record is controlled by whoever owns the IP address, such as your hosting provider, ISP or data centre, not by your domain's DNS zone. Check it with dig -x and a forward lookup, add the A record yourself, then ask the IP owner to set the PTR.
Reading options
On this page
Gmail's sender guidelines tell every sender to "Ensure that sending domains or IPs have valid forward and reverse DNS records, also referred to as PTR records." If you run your own mail server on a VPS, a dedicated server or a cPanel box, that line is about you, and it is often the one check nobody has set up. By the end of this guide you will be able to test your PTR record in one command, confirm it matches your A record, and send your host a clear request to fix it.
What is a PTR record, and why does Gmail care?
A normal DNS lookup turns a name into an IP address. A PTR record is the reverse lookup entry that turns an IP address back into a name.
Think of a phone book read backwards. Normally you look up "Ali's Shop" and find a phone number. With a reverse phone book, you start with the number and find out who owns it.
Gmail's guidelines ask for both lookups to line up. They say "The public IP address of a sending SMTP server must have a corresponding PTR record that resolves to a hostname." Then the same hostname must have an A record (for IPv4) or an AAAA record (for IPv6) that points back to the same IP.
Google puts it plainly: "The sending IP address must match the IP address of the hostname specified in the Pointer (PTR) record." In short, the IP points to a name, and the name points back to the same IP.
Why this matters: only the IP owner can set the PTR, and only the domain owner can set the A record. When both point at each other, the two records agree, which is what Gmail's guidelines ask for.
This is an old rule. RFC 1912, a guide to common DNS mistakes published in February 1996, already said: "Make sure your PTR and A records match."
You may already have SPF, DKIM and DMARC in place. If not, set those up first with our guide to SPF, DKIM and DMARC for small business email. Think of PTR as the fourth leg of the same table.
Who owns the PTR record?
Here is the part that confuses most people. Your domain's DNS zone (the place where you add A, MX and TXT records) does not hold the PTR record for your server's IP.
The PTR record lives in a special reverse zone called in-addr.arpa for IPv4 and ip6.arpa for IPv6. That zone belongs to whoever controls the IP address: your hosting company, your ISP, or the data centre.
cPanel's own documentation says it clearly: "You must have the authority to update the PTR record for the IP address associated with the domain." If you do not, it tells you to "contact the organization that owns it," such as your hosting provider, Internet service provider (ISP), or data center.
So adding a PTR record in your domain registrar's DNS panel does nothing.
Before you start
Run through this short checklist first.
- Who controls the IP: you need to know which company gave you the server's IP address. Usually it is the VPS or dedicated server provider whose invoice you pay.
- Access: you need a login to that provider's control panel, or a way to open a support ticket with them.
- The server name: decide the hostname you want the IP to point to, for example
mail.example.com. It must be a full name, also called an FQDN (fully qualified domain name, a complete name such asmail.example.comrather than justmail). - DNS access for your domain: you must be able to add or edit an A record for that hostname.
- A test machine: any Linux or Mac terminal with the
digtool, or your server itself over SSH. - Time: about 15 minutes of your work, plus whatever time your host needs to make the change.
- Risk level: low. Checking changes nothing. Adding an A record for a new hostname is safe. Changing an existing A record that other services use is where you need care.
Heads up: before you change any DNS record, back up what you have now. Export the zone file from your DNS panel if it offers an export, or take a full screenshot of the record list. If something breaks, you can put the old values back in minutes.
Fix it step by step
Made-up example: Ali runs a small VPS at 192.0.2.10 for his shop's mail on example.com. His messages to Gmail customers keep landing in spam or bouncing, even though SPF and DKIM pass. We will follow his server through each step.
Step 1: Find the IP your mail actually leaves from
Your website and your mail may not use the same IP. Some servers have several IPs, and some route mail through a relay. You want the IP that talks to Gmail.
The easiest way is to send a test email from your server to a Gmail address you own. Open the message in Gmail in a browser, then next to Reply click More and choose Show original.
Google's header page only says the full header shows where a message came from, so look in that text for the IP address of the server that sent it. That is your sending IP.
For Ali, the header shows 192.0.2.10, the same IP as his VPS. If you see an IP from another company, your mail goes through a relay (also called a smarthost), and that company handles PTR for it, not you.
Quick tip: if the sending address is IPv6, such as 2001:db8::10, your server is sending over IPv6. You will need a PTR for that address too. We cover this in the troubleshooting section.
Step 2: Check that dig is installed
The dig tool asks DNS servers questions and prints the answer. Run this command to see if it is installed; it prints the version number and exits.
dig -vYou should see a version line. If you get "command not found" on Debian or Ubuntu, install the bind9-dnsutils package with this command. On Ubuntu, the older dnsutils name is a transitional package that pulls in the same tools.
sudo apt install bind9-dnsutilsOn Fedora, Rocky Linux and similar systems, the tool comes in the bind-utils package. Install it with this command.
sudo dnf install bind-utilsAfter that, dig -v should print a version line, and you are ready to test.
Step 3: Look up the PTR record
The -x option tells dig to do a reverse lookup, and +short asks for a short answer with no extra detail. This command asks "what name belongs to this IP?"
dig -x 192.0.2.10 +shortThere are three possible results. You see a hostname ending in a dot, such as mail.example.com., which is good. You see a generic provider name, which usually looks like a long string of numbers and the provider's domain. Or you see nothing at all, which means no PTR exists.
Behind the scenes, dig turns the IP around and asks for the name 10.2.0.192.in-addr.arpa. That reversed name is why the record sits in the IP owner's zone and not in yours.
Ali gets nothing back. His IP has no PTR record at all, which explains his Gmail trouble.
Step 4: Check the forward match
A PTR on its own is not enough. Now check that the name it returns points back to the same IP. This command asks for the A record of the hostname that the PTR returned.
dig mail.example.com A +shortYou should see exactly the sending IP, here 192.0.2.10. If you see a different IP, or nothing, the pair does not match yet, so it does not meet the Gmail rule above.
Also make sure the hostname has a real A record and is not a CNAME (an alias that points to another name). RFC 1912 says "PTR records must point back to a valid A record, not a alias defined by a CNAME."
Step 5: Create the A record for your mail hostname
If the forward lookup failed, fix your side first. This is the part you control, in your domain's DNS zone.
Back up the zone as described above. Then in your DNS panel, add an A record with name mail (which becomes mail.example.com) and value 192.0.2.10. If you are unsure how your DNS panel maps names to hosts, our guide on how to map a host to a domain walks through it.
Why this matters: do this before you ask your host for the PTR change. Then the pair matches the moment the host sets the PTR, and you can test straight away.
When it is done, the dig mail.example.com A +short command from Step 4 should print 192.0.2.10.
Step 6: Ask the IP owner to set the PTR
Now ask whoever controls the IP to point it at mail.example.com. There are two common ways this works.
Some providers have a "reverse DNS" or "rDNS" field in their control panel next to each IP. Others create the PTR from the server's name, and some only change it through a support ticket. Look in your provider's panel or help pages, and if you cannot find it, ask support. A ready-to-send message is at the end of this guide.
Once the provider confirms the change, run dig -x 192.0.2.10 +short again. You should see mail.example.com. in the answer.
Step 7: Make the server's own name match
Your mail server also introduces itself with a name when it connects to Gmail. This is the HELO name, a greeting the sending server sends at the start of each connection.
Receiving servers can see this name, so it makes sense to use the same hostname as your PTR. On cPanel servers, the Email Deliverability tool shows a message about HELO configuration in its Reverse DNS (PTR) section when the HELO setup and the domain do not match, so you will know.
Ali sets his server's hostname to mail.example.com. His IP, his PTR, his A record and his HELO name now all tell the same story.
Variants
The steps above work everywhere. Only the place you click changes.
cPanel and WHM: Email Deliverability
cPanel has a built-in checker called Email Deliverability. Its documentation says it helps "identify problems with your mail-related DNS records for one or more of your domains," and it covers DKIM, SPF and Reverse DNS (PTR).
In the PTR section, cPanel can "view and verify a domain's current pointer record (PTR)." It reminds you that "A PTR record requires an associated A record." When there is a problem, it shows instructions on how to fix it.
For each domain, the Manage option lets you fix mail-related records by hand, and the Repair feature lets the system fix invalid records for you. cPanel says the repair "can take up to five minutes, depending on the server."
Heads up: Repair does not get around the authority rule. cPanel's own page says you must have the authority to update the PTR record for the IP, so if your host owns the IP, you still need them.
Two more things to know. First, the host has to switch this tool on. It is enabled in WHM » Home » Packages » Feature Manager » Feature Lists, so if you do not see it in cPanel, ask your host.
Second, if your server sends through a smarthost (a relay server that delivers mail for you), the PTR section does not appear at all. Smarthost settings live in WHM » Home » Service Configuration » Exim Configuration Manager, in the Basic Editor section. In that case, the relay's IP is the one that needs a correct PTR.
The cPanel documentation pages I checked do not give a menu path for opening Email Deliverability, so look for it by name in your cPanel or WHM search box, or ask your host.
DirectAdmin and Plesk
The idea is exactly the same: DirectAdmin or Plesk manage your domain's zone, but the PTR still belongs to the IP owner. I did not verify the exact menu paths for these panels today, so I will not guess them. If you are setting up a new panel server, our guide to installing DirectAdmin on a VPS covers the base install, and the PTR request to your host is the same as below.
A provider example: DigitalOcean
At the time of writing (17 October 2026), DigitalOcean documents one common pattern. It says: "We automatically create PTR records for Droplets based on the name you give that Droplet in the Control Panel."
The name must be a valid FQDN. Its docs give the example that a Droplet named example.com gets a PTR record, while one named my-droplet does not. It also says: "You cannot manually create PTR records through the DigitalOcean Control Panel."
On IPv6, DigitalOcean says Droplets "only have PTR records enabled for the first IPv6 address assigned to it."
Providers differ a lot here. One uses the server name, another has an rDNS field, and another wants a ticket. Always check your own provider's help pages.
How to check it worked
Run these checks after your host confirms the change. DNS answers can be cached for a while, so if you see the old result, wait and try again.
First, the reverse lookup. This command should print your mail hostname with a trailing dot.
dig -x 192.0.2.10 +shortmail.example.com.Second, the forward lookup. This command should print the same IP you started with.
dig mail.example.com A +short192.0.2.10If you prefer, the host tool does a reverse lookup by default when you give it an IP address. On Debian it comes in the bind9-host package. This command prints the PTR in a short sentence.
host 192.0.2.10Third, on a cPanel server, open Email Deliverability and look at the Reverse DNS (PTR) section for your domain. It should no longer report a problem.
Fourth, check from outside your own network. MXToolbox has a free Reverse Lookup tool that does a reverse IP lookup on the address you enter. Its page even notes that ISPs generally create and maintain these records.
Finally, send a new test email to Gmail and open Show original again. The sending IP in the header should be the one you just fixed.
Troubleshooting
Problem: dig -x returns nothing
Symptom: dig -x 192.0.2.10 +short prints an empty line. Likely cause: no PTR exists for that IP, or you added a "PTR" in your domain's zone, which has no effect. Fix: ask the IP owner to create it, using the message at the end of this guide.
Problem: the PTR points to a name with no A record
Symptom: dig -x returns mail.example.com., but dig mail.example.com A +short prints nothing. Likely cause: the host set the PTR, but nobody created the forward record. Fix: add the A record in your domain's DNS zone, as in Step 5.
Problem: the A record points to a different IP
Symptom: the forward lookup prints 203.0.113.25, but your mail leaves from 192.0.2.10. Likely cause: the hostname points to your website or an old server. Fix: use a separate mail hostname that points only to the sending IP, or update the A record after backing up the zone and checking nothing else depends on it.
Problem: the PTR shows a generic provider name
Symptom: dig -x returns a long name made of numbers and the provider's domain. Likely cause: the provider's default PTR is still in place. Fix: ask the provider to change it to your hostname, or on a provider like DigitalOcean, check that the server's name is a full FQDN.
Problem: the host says it cannot change the PTR
Symptom: support replies that custom reverse DNS is not available. Likely cause: the IP is shared by many customers, as on most shared hosting, or the plan does not include it. Fix: send mail through your host's mail service or a relay whose IP already has a correct PTR, or move your mail server to a plan with its own IP and rDNS control.
Problem: IPv6 mail has no IPv6 PTR
Symptom: IPv4 checks pass, but the Gmail header shows a sending address like 2001:db8::10. Likely cause: your server prefers IPv6, and that address has no PTR or no matching AAAA record. Fix: check it with dig -x 2001:db8::10 +short, then ask your host for an IPv6 PTR and add an AAAA record for the same hostname.
Pro tips and when to ask for help
Quick tip: use one hostname for mail and keep it stable. Changing the mail name later means changing the PTR, the A record and the HELO name together.
Quick tip: PTR is only part of what Google checks. Its guidelines also say "Use a TLS connection for transmitting email" and ask all senders to keep spam rates reported in Postmaster Tools below 0.3 percent. The same page recommends staying below 0.10 percent and never reaching 0.30 percent.
Security note: a PTR record does not prove you own a domain. Anyone who controls an IP can point it at any name.
Ask your host when the IP is theirs, when you do not see Email Deliverability in cPanel, or when you are on shared hosting. Ask a developer or sysadmin when your server has many IPs and you are not sure which one sends mail, or when changing the server hostname might affect other services.
The one message worth forwarding
Copy this, change the example values to your own, and send it to your hosting provider's support team.
Subject: Please set reverse DNS (PTR) for 192.0.2.10
Hello,
My server at IP 192.0.2.10 sends email for example.com.
Please set the reverse DNS (PTR) record for 192.0.2.10 to:
mail.example.com
The forward record already exists:
mail.example.com A 192.0.2.10
If the server also sends over IPv6, please set the PTR for 2001:db8::10 to mail.example.com as well. I will add the matching AAAA record.
Gmail's sender guidelines require the sending IP to have a PTR record whose hostname resolves back to the same IP.
Please let me know when it is done so I can check it with dig -x.
Thank you.Your takeaway: the PTR record belongs to whoever owns your IP, so add the A record yourself, ask them for the matching PTR, and check both directions with dig.
Reader questions
Can I add a PTR record in my domain registrar's DNS panel?
No. The PTR record lives in the reverse zone for the IP address, which belongs to the IP owner. Your domain's DNS zone only holds the forward A or AAAA record.
Do I need a PTR record if I use Google Workspace or another hosted email service?
Google's guidelines say to verify that an email service provider authenticates your domain's email with SPF and DKIM. The PTR rule is about the public IP address of the sending SMTP server, so it applies to the IP of whichever server sends your mail.
Does the PTR hostname have to match my email domain?
Gmail's rule is that the PTR hostname must resolve back to the sending IP. A hostname inside your own domain, such as mail.example.com, is the simplest choice because you control its A record.
Does each of my domains need its own PTR record?
Google's guidelines tie the PTR to the sending IP: the sending IP must match the IP of the hostname in its PTR record. They also say the activity of any senders using a shared IP address affects the reputation of all senders on it, so the PTR is a property of the IP, not of each domain.
How long does a PTR change take to show up?
It depends on your provider and on DNS caching, so there is no single number. Run dig -x again after the host confirms the change, and wait a little if you still see the old answer.
Is a PTR record enough for Gmail on its own?
No. Google's guidelines also ask all senders to set up SPF or DKIM, use TLS, and keep spam rates in Postmaster Tools below 0.3%. PTR is one of several requirements.
Was this guide helpful?
Help us make the next update better.
Sources & further reading
- Google: Email sender guidelines
- RFC 1912: Common DNS Operational and Configuration Errors
- BIND 9 manual pages (dig)
- cPanel: Email Deliverability in cPanel
- cPanel: Email Deliverability in WHM
- DigitalOcean: How to manage DNS records
- Google: Trace an email with its full headers
- Ubuntu packages: dnsutils (noble)
- Fedora packages: bind-utils
- MXToolbox: Reverse Lookup
Originally published . About our editorial updates.


