PTR record and reverse DNS are used by e-mail servers to verify the authenticity of the sender by correctly setting the reverse DNS resolution of a domain, thus making it possible to verify the trustworthiness of the sender server and preventing his e-mails from being considered Spam¬†
It seems complicated to understand the operation of the PTR record but for those who manage, even in a simplistic way, a DNS server or are put in a position of having to configure it for a domain that will manage an email server, the creation of a PTR record will be basic and will prevent the emails sent from that server from being marked as Spam even though they are not.
Many people have tried, correctly, to generate DMARC, DKIM and configure the string of the TXT SPF record, failing to understand why the servers receiving the e-mails were still marking them as Spam.
The reason is very simple, the PTR record was missing or it was badly configured or the manager providing the Internet line did not know how to configure it correctly by linking the static IP assigned to you with the name of the mail server that will have to operate to send the e-mails.
Certainly, because the PTR record is not related to the e-mails that are received by the server, but is related to the SMTP protocol and it is useless to think of using SMTPS, i.e. certified sending, because it would change absolutely nothing.
We must bear in mind that when we generate an A record in our DNS server, there is an association between our IP and the service that we are going to serve.
For example, to serve a server that has to display an Internet site, whether it is hosted on Apache, on Microsoft’s II Server or on another HTTP server, we must associate in the A record the IP that the Internet manager has assigned to us statically and NOT dynamically, this is also important for the PTR record.
Here is a quick example:
This is how we need to configure the A record for the domain name Pippo.IT to allow someone who wants to visit that website to view it on their browser.
In practice, a DNS server performs a numerical humanisation operation, i.e. instead of writing the IP address of Pippo.IT, it associates it with a mnemonic name (easier to remember) to allow a human being to reach the pages of the site that interest him, the same thing can be said for the PTR record, even if it has a particular format that distinguishes it: static IP + in-addr.arpa associated with a domain name.
This is a very simplistic explanation, but in practice this is what happens at a basic level even for the PTR record, then there are configuration techniques such as TTL (Time to Live) with a value of 86400, which is equivalent to 86400 seconds = 1 day.
Any record we are going to register in our DNS server will have a value that will make navigation more or less fast since we will not need to check every time if the IP has changed and we will lighten the work of our authoritative server.
We’ll stop here because otherwise we’ll go off topic and at the moment we’re talking about the PTR record related to Spam issues.
To write a PTR record we have to take our IP address and turn it completely upside down, so if we have:
220.127.116.11 as a static IP address assigned by our internet provider, we will have to write 18.104.22.168-in.addr.arpa and as a record type we will choose PTR with the association of a domain that in our case we have defined as PIPPO.IT but……it will be better to address it to smtp.pippo.it in order to have already ready the way to correctly configure our mail server.
The PTR record is of fundamental importance in order to avoid ending up among spammers, in fact there are organisations worldwide that record presumed or real Spam operations to which many servers refer and immediately discard incoming emails without even getting them to the recipient.
Email servers use reverse DNS resolution (rDNS), which allows them to verify the domain name and authority of that server to forward emails.
Many providers who host websites, because of the spam that many have used for unwanted newsletters or unintentional emailing caused by viruses or other, have stopped making their email servers available and only host the website to avoid being marked as a spammer and do not allow the customer to use their PTR record under penalty of having their hosting provision terminated.
Once our PTR record has been correctly configured and we have asked our Internet manager for the link between the static IP assigned and the mnemonic identification address (smtp.pippo.it), we will just have to wait a few days and then we can check, thanks to a Google search, whether everything has become linearly operational.
All we have to do is type in “reverse DNS” and click on one of the many websites that allow online DNS verification.
Otherwise, we can use a GNU/Linux operating system where, thanks to the command “dig”, we can verify the exact same thing:
dig -x 22.214.171.124
The result should be similar to this and will allow you to understand if the PTR record and your Internet provider have started working correctly.
;; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> -x 126.96.36.199
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44730
;;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;188.8.131.52.in-addr.arpa. IN PTR
;; ANSWER SECTION:
184.108.40.206.in-addr.arpa. 86400 IN PTR smtp.pippo.it.¬† ¬† <——– Here’s what should appear with a correct PTR record
;; Query time: 207 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Wed Jun 16 17:06:58 CEST 2021
;; MSG SIZE rcvd: 8
Or we can use another command that is usually easier to remember:
220.127.116.11.in-addr.arpa name = smtp.pippo.it <——– Here is what should appear with a correct PTR record
Authoritative answers can be found from:
We now know how important the correct creation of a PTR record can be in order not to end up with spam domains.
We should always remember to set SPF, DKIM and DMARC records as well to increase the credibility of our mail server and its reputation as well as having a near certainty that our emails will not end up destroyed or placed in a recipient’s spam folder.