ReplyDak

How to add SPF, DKIM and DMARC records in DigitalOcean DNS

Updated 10 November 2026 · 4 min read

Short answer

In the DigitalOcean control panel go to Networking → Domains, select the domain, and use Create a record: type TXT, Hostname @ for SPF, _dmarc for DMARC, or selector._domainkey for DKIM, then Create Record. MX records use Hostname @ with your provider's mail server and a priority. If you send mail directly from a droplet, also name the droplet after its mail hostname so its reverse DNS (PTR) matches.

DigitalOcean record fields

RecordTypeHostnameValue
SPFTXT@v=spf1 include:_spf.google.com ~all
DKIMTXTgoogle._domainkeyv=DKIM1; k=rsa; p=…
DKIM (hosted)CNAMEs1._domainkeyprovider target (Is an alias of)
DMARCTXT_dmarcv=DMARC1; p=none; rua=mailto:…
MXMX@smtp.google.com, priority 1

Sending from a droplet

If a droplet runs Postfix or another MTA and sends mail itself, three more things matter. Its IP must be in your SPF record (ip4:203.0.113.10). It needs reverse DNS: DigitalOcean sets the PTR record from the droplet's name, so name the droplet mail.yourdomain.com and create a matching A record; Gmail rejects mail from IPs without a valid PTR (codes 4.7.23 and 5.7.25, see Gmail 5.7.25). And it must sign with DKIM itself, for example with OpenDKIM, publishing the key as a TXT record here.

Step by step

  1. 1

    Check delegation

    DigitalOcean DNS only answers if the registrar points to ns1/ns2/ns3.digitalocean.com.

  2. 2

    Add MX

    Create a record → MX → Hostname @ → mail server → priority. Add one record per server your provider lists.

  3. 3

    Add SPF, DKIM, DMARC

    Create a record → TXT for each, with the hostnames in the table.

  4. 4

    CNAME targets

    For hosted DKIM CNAMEs, enter the provider's hostname exactly; follow the provider's instructions about a trailing dot.

Worked example: app mail from a droplet plus Google Workspace

@                 TXT  v=spf1 ip4:203.0.113.10 include:_spf.google.com ~all
mail              A    203.0.113.10
default._domainkey TXT v=DKIM1; k=rsa; p=MIIBIjAN... (OpenDKIM key)
google._domainkey TXT  v=DKIM1; k=rsa; p=MIIBIjAN... (Google key)
_dmarc            TXT  v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com
Droplet name: mail.yourdomain.com  (sets the PTR)

Check the result

The check also looks up your MX hosts' IPs on blocklists, which matters if the droplet receives mail. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.

More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.

FAQ

What hostname do I use for the root in DigitalOcean DNS?

@ for the apex domain.

How do I set reverse DNS on a DigitalOcean droplet?

The PTR record is set from the droplet's name. Rename the droplet to a fully qualified hostname like mail.yourdomain.com that has a matching A record.

Can I put two DKIM keys on one DigitalOcean domain?

Yes. Each uses its own selector hostname, such as default._domainkey and google._domainkey.

Sources

Related

Microsoft 365 mailboxes are coming soon. Until then, new orders use Google Workspace mailboxes.