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.

SpamBarometer Team
April 5, 2025
8 min read

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.
The following diagram illustrates the basic flow of incoming email delivery using MX records:
Diagram 1
Diagram 1

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.

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: SPF records have a maximum length of 255 characters. If your SPF record exceeds this limit, you can use the include mechanism to reference additional records.
The following diagram shows how SPF validation works during email delivery:
Diagram 2
Diagram 2

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 the message headers using the private key. The receiving server then retrieves the public key from your DNS and verifies the signature. This ensures the email originated from an authorized sender and hasn't been tampered with.

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
The following diagram illustrates the DKIM signing and verification process:
Diagram 3
Diagram 3

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 reports
  • 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. If either of these checks fail, the server then refers to the DMARC policy to determine the appropriate action (e.g., accept, quarantine, 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 30 days Monitor SPF and DKIM alignment without affecting email delivery
2 quarantine 30 days Quarantine failed messages for further analysis
3 reject Ongoing Reject all messages that fail SPF and DKIM alignment
The following diagram shows how DMARC aligns SPF and DKIM results to determine the appropriate action:
Diagram 4
Diagram 4

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 SVG logo, 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 Verified Mark Certificate (VMC), required for additional verification

To be eligible for BIMI, your domain must have a DMARC policy of "quarantine" or "reject", and you must obtain a Verified Mark Certificate (VMC) from a participating Certificate Authority. The VMC verifies your organization's identity and ownership of the brand logo.

Benefits of BIMI: Implementing BIMI can increase brand visibility, build trust with recipients, and potentially improve email engagement rates.
The following diagram illustrates how BIMI works in conjunction with DMARC to display verified brand logos:
Diagram 5
Diagram 5

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 records, starting with permissive policies and gradually tightening them
  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.

Was this guide helpful?
Need More Help?

Our team of email deliverability experts is available to help you implement these best practices.

Contact Us