Properly Configuring Email DNS Records for Optimal Deliverability

A comprehensive guide to all DNS records relevant to email sending, including MX, SPF, DKIM, DMARC, BIMI, and more.

Optimizing email deliverability requires properly configuring several critical DNS records. This comprehensive guide dives deep into the purpose, syntax, and best practices for key email-related DNS records including MX, SPF, DKIM, DMARC, and BIMI. By implementing these records correctly, you can significantly improve email delivery rates, protect your domain reputation, and provide a better experience for email recipients. Let's explore each record type in detail.

MX Records: Directing Incoming Email Traffic

MX (Mail Exchanger) records specify the mail servers responsible for accepting email messages on behalf of your domain. Properly configuring MX records is crucial for ensuring incoming emails reach their intended destination.

An MX record consists of the following components:

  • Domain name: The domain for which the MX record applies (e.g., yourdomain.com)
  • Record type: Always "MX" for Mail Exchanger records
  • Priority: A numeric value indicating the preference order of mail servers, with lower values having higher priority
  • Mail server: The hostname of the mail server that will handle incoming emails for the specified domain

Here's an example of MX records for a domain:

yourdomain.com.  IN  MX  10  mail1.yourdomain.com.
yourdomain.com.  IN  MX  20  mail2.yourdomain.com.
    

In this example, mail1.yourdomain.com is the primary mail server with a priority of 10, and mail2.yourdomain.com is the backup server with a lower priority of 20. If the primary server is unavailable, email will be delivered to the backup server instead.

Best Practice: Always provide at least two MX records with different priorities to ensure email delivery continuity in case the primary server experiences issues.
Five DNS records for email: MX routes incoming mail, SPF lists servers allowed to send, DKIM publishes the key that verifies signatures, DMARC sets the policy for failed checks, and BIMI points to a brand logo.
The five email DNS records and the job each one does

SPF Records: Authorizing Outbound Email Servers

SPF (Sender Policy Framework) records specify which mail servers are permitted to send emails on behalf of your domain. By publishing an SPF record, you can reduce email spoofing and improve deliverability by identifying legitimate email sources. Receivers check SPF against the envelope sender (the MAIL FROM or Return-Path domain), not the From address your recipients see.

An SPF record is a TXT record with the following format:

yourdomain.com.  IN TXT  "v=spf1 ip4:192.0.2.0/24 ip6:2001:db8::/32 include:example.com -all"
    

The SPF record consists of the following mechanisms:

  • ip4: Allows a specific IPv4 address or range
  • ip6: Allows a specific IPv6 address or range
  • include: Includes SPF records from another domain
  • all: Specifies the default action for unlisted servers ("-" denotes hard fail)

It's important to build your SPF record incrementally, including only the necessary mail servers and third-party services. A well-constructed SPF record helps receiving mail servers identify authorized senders and block fraudulent emails.

Note: A single TXT string can be at most 255 characters, but a record can hold several strings, which receivers join together. The more important limit is 10 DNS lookups: mechanisms such as include, a, mx and redirect each count, and a record that needs more than 10 lookups fails SPF. Remove services you no longer use before adding new ones.

DKIM Records: Verifying Email Authenticity

DKIM (DomainKeys Identified Mail) is a protocol that allows email senders to cryptographically sign outgoing messages. By publishing a DKIM record in your DNS, receiving mail servers can verify the signature and ensure the email hasn't been altered in transit.

To set up DKIM, you need to generate a public-private key pair and publish the public key in your DNS as a TXT record. The DKIM record has the following format:

      
selector._domainkey.yourdomain.com.  IN TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."  
    

The DKIM record contains the following elements:

  • Selector: A unique identifier for the DKIM record (e.g., "default" or "20210101")
  • Domain: The domain name prepended with "_domainkey"
  • Public key: The RSA public key used to verify the DKIM signature

When sending an email, your mail server signs selected headers and the message body using the private key. The receiving server then retrieves the public key from your DNS and verifies the signature. This shows the message was authorized by the signing domain and hasn't been changed in transit.

Implementing DKIM: Best Practices

  • Rotate DKIM keys periodically (e.g., every 6-12 months) to maintain security
  • Use a unique selector for each key rotation to simplify key management
  • Ensure your email content doesn't trigger spam filters, as DKIM alone doesn't guarantee deliverability

DMARC Records: Aligning SPF and DKIM Policies

DMARC (Domain-based Message Authentication, Reporting, and Conformance) is an email authentication protocol that builds upon SPF and DKIM. It allows domain owners to specify how receiving mail servers should handle messages that fail SPF and/or DKIM checks.

A DMARC record is published as a TXT record with the following format:

      
_dmarc.yourdomain.com.  IN TXT  "v=DMARC1; p=reject; rua=mailto:dmarc-reports@yourdomain.com; ruf=mailto:dmarc-forensics@yourdomain.com; fo=1"
    

The DMARC record consists of several key tags:

  • v: The DMARC version (always "DMARC1")
  • p: The policy for handling failed messages ("none", "quarantine", or "reject")
  • rua: The email address for aggregate reports
  • ruf: The email address for forensic (failure) reports, which many large mailbox providers don't send
  • fo: The failure reporting options (0, 1, d, or s)

When a receiving mail server processes an incoming email, it performs SPF and DKIM checks. A message passes DMARC if SPF or DKIM passes and that passing domain aligns with the From domain; one is enough. Relaxed alignment (the default) only needs the same organisational domain, while strict alignment needs an exact match. If neither aligned check passes, the server refers to the DMARC policy to decide what to do (deliver as normal, send to spam, or reject the message).

Implementing DMARC: A Phased Approach

Deploying DMARC requires careful planning and a phased rollout to avoid disrupting legitimate email flow. Start with a "none" policy and gradually progress to "quarantine" and "reject" as you gain confidence in your SPF and DKIM configurations.

Phase Policy Duration Description
1 none Several weeks Monitor SPF and DKIM alignment without affecting email delivery
2 quarantine Several weeks Failing messages go to spam; keep reviewing reports for legitimate sources you missed
3 reject Ongoing Reject messages where neither SPF nor DKIM passes with alignment
The following diagram shows how DMARC aligns SPF and DKIM results to determine the appropriate action:
A receiving server runs SPF and DKIM, checks that at least one passing result matches the From domain, then applies the DMARC policy: aligned mail is delivered, while failing mail is reported, sent to spam or rejected depending on whether the policy is none, quarantine or reject.
How a receiver applies your DMARC policy

BIMI Records: Displaying Verified Brand Logos

BIMI (Brand Indicators for Message Identification) is an emerging standard that allows domain owners to display their verified brand logo next to emails in supporting email clients. By implementing BIMI, you can improve brand recognition and build trust with recipients.

To set up BIMI, you need to create a logo in the SVG Tiny Portable/Secure format, host it on an HTTPS URL, and publish a BIMI record in your DNS. The BIMI record is a TXT record with the following format:

    
default._bimi.yourdomain.com.  IN TXT  "v=BIMI1; l=https://yourdomain.com/logo.svg; a=https://yourdomain.com/vmc.pem"    
    

The BIMI record contains the following elements:

  • v: The BIMI version (currently "BIMI1")
  • l: The URL of your brand logo in SVG format
  • a: The URL of your mark certificate (a VMC or CMC), which Gmail requires before it shows the logo

To be eligible for BIMI, your domain must have a DMARC policy of "quarantine" or "reject", and Gmail requires a Verified Mark Certificate (VMC) or Common Mark Certificate (CMC) from a participating Certificate Authority. The certificate verifies your organization's identity and its right to use the logo.

Benefits of BIMI: Implementing BIMI can increase brand visibility, build trust with recipients, and potentially improve email engagement rates.

Monitoring and Maintaining Email Authentication Records

Properly configuring your email authentication DNS records is an ongoing process. It's crucial to monitor your records regularly and make necessary adjustments to ensure optimal email deliverability. Some key tasks include:

  • Monitoring DMARC aggregate and forensic reports for authentication failures
  • Updating SPF records when adding or removing authorized mail servers
  • Rotating DKIM keys periodically to maintain security
  • Reviewing and updating your DMARC policy as needed
  • Ensuring your BIMI logo and VMC remain accessible and up-to-date

By staying proactive and regularly maintaining your email authentication records, you can protect your domain reputation, improve deliverability, and provide a safer, more trustworthy email experience for your recipients.

Conclusion and Next Steps

Implementing proper email authentication DNS records is essential for any organization that relies on email communication. By understanding and configuring MX, SPF, DKIM, DMARC, and BIMI records correctly, you can:

  • Ensure incoming emails reach their intended recipients
  • Prevent email spoofing and protect your domain reputation
  • Improve email deliverability and reduce the risk of messages being marked as spam
  • Display verified brand logos to build trust with recipients

To get started with email authentication, follow these steps:

  1. Audit your current DNS records and identify any missing or misconfigured entries
  2. Implement SPF and DKIM for every service that sends mail as your domain
  3. Deploy DMARC with a phased approach, monitoring reports and adjusting as needed
  4. Consider implementing BIMI to display your verified brand logo and build trust with recipients
  5. Continuously monitor and maintain your email authentication records to ensure ongoing deliverability and security

By prioritizing email authentication and following best practices, you can create a more secure, trustworthy email ecosystem for your organization and your recipients.

Check your own email in a minute. Send one email to a test address and see your SPF, DKIM, DMARC and spam score.
Test your email
Was this guide helpful?

Topics: Deliverability, Authentication, Best Practices, Technical