How to Add a TXT Record for SPF and DKIM

Updated 25 February 2026 11 views DNS & Nameservers

Email Authentication with TXT Records

TXT records are versatile DNS records that store text data. In the context of email, they are primarily used for SPF, DKIM, and DMARC authentication, which help prevent email spoofing and improve deliverability.

What Is SPF?

Sender Policy Framework (SPF) specifies which mail servers are authorised to send email on behalf of your domain. Receiving servers check SPF records to verify the sender is legitimate.

Adding an SPF Record

  1. In your DNS management panel, add a new TXT record.
  2. Set the Name to @.
  3. Set the Value to your SPF policy. Common examples:
    • SillyHost only: v=spf1 a mx ~all
    • SillyHost + Google Workspace: v=spf1 a mx include:_spf.google.com ~all
    • SillyHost + Microsoft 365: v=spf1 a mx include:spf.protection.outlook.com ~all
  4. Save the record.

What Is DKIM?

DomainKeys Identified Mail (DKIM) adds a digital signature to outgoing emails, allowing the recipient's server to verify that the message was not altered in transit and genuinely came from your domain.

Adding a DKIM Record

  1. Obtain your DKIM public key from your email provider (found in the admin panel of Google Workspace, Microsoft 365, or your server's mail configuration).
  2. Add a new TXT record.
  3. Set the Name to the DKIM selector provided (e.g., default._domainkey or google._domainkey).
  4. Set the Value to the DKIM public key string (e.g., v=DKIM1; k=rsa; p=MIGfMA0GCS...).
  5. Save the record.

What Is DMARC?

DMARC builds on SPF and DKIM to tell receiving servers what to do when authentication fails. A basic DMARC record looks like:

  • Name: _dmarc
  • Value: v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com

Best Practices

  • Always configure all three (SPF, DKIM, and DMARC) for maximum email deliverability.
  • Only have one SPF record per domain. If you use multiple email services, combine them into a single SPF record using include: statements.
  • Start DMARC with p=none to monitor before enforcing.

Was this article helpful?

Let us know so we can improve our docs.