One of the most basic ways to use DNS for email routing is to configure your DNS records correctly. DNS records are entries in a database that specify how to handle different types of requests for your domain. For email, you need at least two types of records: MX and TXT.
MX records, or mail exchange records, tell other mail servers where to send your incoming email. You can have multiple MX records with different priorities, so that if one mail server is down or busy, another one can take over. You can also use MX records to balance the load between multiple mail servers or to route email to different domains or subdomains.
TXT records, or text records, are used to store arbitrary information that can be verified by other parties. For email, you can use TXT records to implement SPF, DKIM, and DMARC, which are protocols that help prevent email spoofing, phishing, and spamming. SPF, or Sender Policy Framework, specifies which IP addresses are allowed to send email from your domain. DKIM, or DomainKeys Identified Mail, adds a digital signature to your email that can be verified by the recipient. DMARC, or Domain-based Message Authentication, Reporting, and Conformance, defines how to handle email that fails SPF or DKIM checks.