XiaTools

Step-by-Step Guide to Adding DKIM Records in DigitalOcean DNS

By Rohit, founder of XiaTools · Updated 18 Oct 2026

Configuring your DigitalOcean DNS DKIM setup correctly is one of the most critical steps you can take to ensure your outbound emails reach the inbox instead of the spam folder. DomainKeys Identified Mail (DKIM) adds a cryptographic signature to your email headers, proving to mailbox providers that the message genuinely originated from your domain and was not altered in transit. Without this configuration, your emails are far more likely to be flagged or rejected by modern security filters.

Before you begin making changes to your domain configuration, you should verify your existing mail delivery setup using the DKIM Checker to identify any missing keys or syntax errors currently affecting your infrastructure.

Understanding DKIM and DigitalOcean DNS Basics

When you set up email for your domain, your email service provider (ESP) such as Google Workspace, Microsoft 365, Postfix, or Sendgrid generates a unique public-private key pair. The private key is kept securely on your mail server to sign outgoing messages. The public key must be published in your public DNS records so receiving servers can verify those signatures.

DigitalOcean manages DNS through its centralized control panel, which supports all standard record types including CNAME and TXT. Because DKIM keys are often long strings of alphanumeric data, understanding how to format them correctly within DigitalOcean's interface prevents common syntax errors like trailing spaces or line breaks.

Required Information Before You Start

Gather the following details from your email service provider before logging into DigitalOcean:

  • Selector Name: A short prefix used to identify the specific key (e.g., google, smtp, or k1).
  • Record Type: Usually a TXT record, though some modern providers use CNAME records for automated key rotation.
  • Record Value: The cryptographic public key string or the target domain for the CNAME alias.

Step-by-Step DigitalOcean DNS DKIM Setup

Follow these sequential steps to add your DKIM keys into the DigitalOcean DNS management console.

Step 1: Access Your DigitalOcean Account

Log in to your DigitalOcean control panel using your credentials. From the main dashboard, navigate to the Networking section in the left-hand sidebar and click on the Domains tab.

Step 2: Select Your Domain

Find the domain name where you want to add the DKIM record (for example, example.com) in your list of domains and click on it to open the DNS record management interface.

Step 3: Add the DKIM Record

Depending on your provider, you will add either a TXT record or a CNAME record. Look for the record creation form at the top of the DNS records table.

If your provider gave you a TXT record format:

  1. Select TXT from the record type dropdown menu.
  2. In the HOSTNAME field, enter your selector followed by ._domainkey (for example, google._domainkey). Do not include your base domain name, as DigitalOcean automatically appends it.
  3. In the VALUE field, paste the full public key string provided by your ESP. It typically starts with v=DKIM1; k=rsa; p=....
  4. Click Create Record to save.

If your provider uses CNAME records for automated DKIM:

  1. Select CNAME from the record type dropdown menu.
  2. In the HOSTNAME field, enter the selector and alias provided (e.g., s1._domainkey).
  3. In the WILL SEND DATA TO field, paste the target domain provided by your ESP (e.g., s1.domainkey.example.com.). Ensure you include the trailing dot if required by your provider.
  4. Click Create Record to save.

Verifying Your DKIM Configuration

Once you have added the record to DigitalOcean, you need to verify that global DNS servers have propagated the change and that the syntax is correct. Keep in mind that DNS propagation can take anywhere from a few minutes to a few hours depending on your previous TTL settings.

Using Command Line Tools

You can query your new DNS record using standard command-line tools like dig or nslookup from your local machine.

dig TXT google._domainkey.example.com +short

If configured correctly, the output should display your public key string enclosed in quotation marks:

"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."

If you are testing on a Windows machine via PowerShell, you can use Resolve-DnsName:

Resolve-DnsName -Name "google._domainkey.example.com" -Type TXT

Comparing DNS Record Types for DKIM

Record Type Typical Use Case Pros Cons Note for DigitalOcean
TXT Traditional static keys Full control, widely supported Must be updated manually if keys expire Paste the full public key string into VALUE.
CNAME Managed ESP hosting Automatic key rotation by provider Relies on provider uptime for DNS resolution Include trailing dot in target if specified.

Common Mistakes and How to Fix Them

Even experienced engineers occasionally run into formatting issues when deploying email authentication records. Watch out for these frequent pitfalls:

  • Duplicate Domain Append: DigitalOcean automatically appends your base domain to the hostname field. If your provider tells you to add selector._domainkey.example.com, you should only enter selector._domainkey in the DigitalOcean hostname field. Entering the full domain name results in broken lookups like selector._domainkey.example.com.example.com.
  • Length Limits on TXT Records: Standard DNS limits individual TXT strings to 255 characters. If your RSA 2048-bit key is split into multiple quoted strings by your provider, you must ensure DigitalOcean accepts the concatenated format without breaking character escaping.
  • Trailing Spaces: Accidentally copying a whitespace character at the beginning or end of your public key value will cause cryptographic verification failures.

Quick DKIM Setup Checklist

  • Gathered selector and public key from your email provider.
  • Logged into DigitalOcean and navigated to Networking > Domains.
  • Entered the correct hostname using the selector._domainkey format.
  • Pasted the exact TXT value or CNAME target without trailing spaces.
  • Verified propagation using dig or an online validation tool.
  • Sent a test email to an external mailbox and checked headers for dkim=pass.

Related articles

Free tools