DNS handles more than just web traffic
MX Record (Mail Exchanger)
When someone sends an email to [email protected], their mail server needs to know which server to deliver it to. It looks up the MX records for example.com. MX records point to hostnames (not IP addresses directly), and each has a priority value. Lower numbers mean higher priority — the sending server tries the lowest-numbered MX first and falls back to higher-numbered ones if delivery fails.
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
Without at least one MX record, your domain cannot receive email. The hostnames in MX records must themselves resolve to A or AAAA records — you cannot use a CNAME as an MX target (per RFC 2181).
TXT Record (Text)
Originally designed for arbitrary human-readable notes, TXT records are now almost exclusively used for machine-readable verification and email authentication:
- Domain ownership verification: Google Workspace, GitHub, and other services ask you to add a specific TXT record to prove you control the domain before they activate services for it.
- SPF (Sender Policy Framework): A TXT record that lists which mail servers are authorized to send email on behalf of your domain. Receiving servers check this to filter spam.
- DKIM (DomainKeys Identified Mail): A TXT record that publishes a public key used to verify cryptographic signatures on outgoing emails.
- DMARC: A TXT record that tells receiving servers what to do when SPF or DKIM checks fail (quarantine, reject, or do nothing).
example.com. TXT "v=spf1 include:_spf.google.com ~all"
SRV Record (Service)
SRV records generalize the concept of service discovery. They specify not just a hostname but also a port number, protocol, and priority/weight for a specific service. They are used by protocols like SIP (VoIP), XMPP (chat), LDAP, and some game servers.
_sip._tcp.example.com. SRV 10 60 5060 sipserver.example.com.
The format is: _service._proto.name. TTL IN SRV priority weight port target.