schedule 16-min read

How to Add a DMARC Record in DigitalOcean DNS

DMARC AI editorial team · Last updated

Add a DMARC TXT record in DigitalOcean DNS with the control panel, doctl or the API: Hostname _dmarc, ns1.digitalocean.com checks and MSP tips.

01

How do you add a DMARC record in DigitalOcean DNS?

To add a DMARC record in DigitalOcean DNS, open Networking, go to the Domains tab and click the domain. Click Create a record, choose TXT, enter _dmarc as the Hostname and a value such as v=DMARC1; p=none; rua=mailto:reports@example.net as the TXT Value, then click Create Record.

That only works when the domain is delegated to DigitalOcean's name servers. DigitalOcean hosts DNS but does not send your email, so the SPF and DKIM records that DMARC depends on come from whoever actually sends the mail. This guide covers the delegation check, the control panel, doctl, the API v2, Terraform, verification with dig, common mistakes and running many client domains as an MSP (managed service provider). DMARC (Domain-based Message Authentication, Reporting and Conformance) builds on SPF (Sender Policy Framework) and DKIM (DomainKeys Identified Mail). For the protocol itself, start with the DMARC guide.

Interface note: labels follow DigitalOcean's documentation as read in November 2026. The docs name the TXT fields Hostname and TXT Value but do not describe the TTL control in the panel, so check the form you see and confirm the result with dig.

02

Key takeaways

  • DMARC in DigitalOcean is a TXT record with the Hostname _dmarc. The Hostname field takes @ for the apex or a prefix, so do not type the full domain.
  • A record only counts when the registrar points the domain at ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com. DigitalOcean is not a registrar.
  • DigitalOcean does not send mail for you. Droplets block outbound SMTP ports by default, so SPF and DKIM come from your email service, not from DigitalOcean.
  • doctl defaults to a TTL of 1800 seconds, and every DigitalOcean record needs a TTL of at least 30 seconds.
  • Leave out pct, ri and rf. RFC 9989 removed them; move from p=none to p=quarantine to p=reject in whole steps.
03

Is the domain's DNS actually hosted at DigitalOcean?

Check this first. DigitalOcean's registrar guide says it is not a domain registrar, so you register the name elsewhere and set its name servers to ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com. A record saved in DigitalOcean is only served if those name servers are live.

$ dig +short NS example.com
ns1.digitalocean.com.
ns2.digitalocean.com.
ns3.digitalocean.com.

On Windows, run nslookup -type=NS example.com, or use our DNS lookup tool without a terminal. If the answer names another provider, add _dmarc there instead.

Name servers point to Where to add _dmarc
ns1.digitalocean.com and siblings DigitalOcean control panel, doctl or API
Cloudflare See how to add a DMARC record in Cloudflare DNS
Amazon Route 53 (awsdns) See how to add a DMARC record in Amazon Route 53
Google Cloud DNS (ns-cloud-*) See how to add a DMARC record in Google Cloud DNS
Azure DNS See adding a DMARC record in Azure DNS
A registrar's own DNS The registrar's panel, for example 123-reg or Namecheap

What changes when you move a domain to DigitalOcean DNS?

DigitalOcean says a name server change may take between 30 minutes and several hours to spread. Copy every existing record first, because the old zone does not move with the delegation. Its DNS limits page also says its name servers do not support domains with DNSSEC (Domain Name System Security Extensions) enabled, so plan that before you switch. DNS management is free.

To add the domain, DigitalOcean's add domains guide uses Add a domain on the Domains tab, a Domain field and a Project drop-down. A new domain starts with NS and SOA records only.

04

What are the exact steps in the DigitalOcean control panel?

Open the domain, click Create a record, pick TXT, fill in Hostname and TXT Value, and click Create Record. These steps follow DigitalOcean's guide to creating, editing and deleting DNS records, with DMARC values filled in.

  1. Log in to the DigitalOcean control panel and switch to the team that owns the domain.
  2. Open the Networking page and select the Domains tab.
  3. Click the domain, for example example.com.
  4. Check the record list for an existing TXT record at _dmarc. If one exists, edit it instead of adding a second.
  5. Click Create a record and choose TXT.
  6. Hostname: _dmarc.
  7. TXT Value: the full DMARC string on one line.
  8. Set a short TTL while you test, if the form offers one. The minimum is 30 seconds.
  9. Click Create Record.

A first record in monitoring mode:

v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net

To change it later, open the record's More menu (the three dots on the right) and click Edit record. If you are unsure of the syntax, build the value with the DMARC record generator or follow how to create a DMARC record step by step, which explains each tag.

Do you enter _dmarc or _dmarc.example.com as the Hostname?

Enter _dmarc. DigitalOcean's records guide says the TXT Hostname can be the apex, entered as @, or a subdomain prefix such as www. The DMARC record lives at _dmarc.example.com, so the prefix is _dmarc. For a subdomain such as shop.example.com, enter _dmarc.shop.

Do not enter @ for DMARC. A TXT record at @ sits on the domain itself, where SPF lives, and receivers never read it as a DMARC policy. More patterns are in DMARC record examples for common setups.

Should the TXT Value have quotation marks?

Enter it without surrounding quotation marks. DigitalOcean's example TXT value, example_name=example_value, is unquoted, and its docs give no quoting rule or TXT length limit. Paste from a plain text editor, because curly quotes from a word processor break the record. Then check with dig that one clean string comes back.

05

How do you add the DMARC record with doctl?

Run doctl compute domain records create with the domain, --record-type TXT, --record-name _dmarc and the value in --record-data. Quote the value for your shell, because it contains spaces and semicolons. The flags come from the doctl records create reference.

doctl compute domain records create example.com 
  --record-type TXT 
  --record-name _dmarc 
  --record-data "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net" 
  --record-ttl 300

--record-ttl is in seconds and defaults to 1800 if you leave it out. --record-type accepts A, AAAA, CAA, CNAME, MX, NS, SOA, SRV or TXT. Add --output json when a script needs to read the result.

List the records to find the DMARC record and its ID:

doctl compute domain records list example.com --format ID,Type,Name,Data,TTL

How do you change the DMARC policy with doctl?

Use doctl compute domain records update with the record's --record-id and the new value. The update reference lists the same flags as create, but --record-ttl shows a default of 0 there, so pass the type, name, data and TTL explicitly rather than relying on defaults.

doctl compute domain records update example.com 
  --record-id 12345678 
  --record-type TXT 
  --record-name _dmarc 
  --record-data "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.net" 
  --record-ttl 300

Running create a second time does not replace the policy. It adds a second TXT record at _dmarc, which disables DMARC (see below).

06

How do you add the DMARC record with the DigitalOcean API?

Send a POST to https://api.digitalocean.com/v2/domains/{domain_name}/records with a bearer token and a JSON body that sets type, name, data and ttl. DigitalOcean's domain records API reference lists the fields and says the call needs the domain:create scope.

curl -X POST 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer $TOKEN" 
  -d '{"type":"TXT","name":"_dmarc","data":"v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net","ttl":300}' 
  "https://api.digitalocean.com/v2/domains/example.com/records"

A successful call returns 201 with a domain_record object that includes the record's id. To find an existing DMARC record, filter the list call by type and fully qualified name, which needs domain:read:

curl -H "Authorization: Bearer $TOKEN" 
  "https://api.digitalocean.com/v2/domains/example.com/records?type=TXT&name=_dmarc.example.com"

To change the policy, send a PATCH or PUT to /v2/domains/example.com/records/{domain_record_id} with the new data. Both need the domain:update scope.

07

Can you manage the DMARC record with Terraform?

Yes. The DigitalOcean provider on the Terraform Registry includes a digitalocean_record resource. Its argument reference requires domain, type, name and value, accepts TXT as a type and defaults ttl to 1800 seconds.

resource "digitalocean_record" "dmarc" {
  domain = "example.com"
  type   = "TXT"
  name   = "_dmarc"
  value  = "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net"
  ttl    = 300
}

The provider says ttl must be at least 0, but the platform minimum is 30 seconds, so use 30 or more. If a _dmarc record already exists in the panel, import it into state or delete it first, or you end up with two.

08

Where do SPF and DKIM come from on DigitalOcean?

From the service that sends the mail, not from DigitalOcean. DigitalOcean's SMTP support page says ports 25, 465 and 587 are blocked on Droplets to prevent spam, and it recommends a third party email service rather than running your own mail server.

The typical setups look like this:

Setup Who signs and sends What you publish in DigitalOcean DNS
App on a Droplet sending transactional mail An email service provider (ESP) through its API or relay The ESP's SPF include and DKIM records, for example SendGrid, Mailgun or Amazon SES
Postfix on a Droplet relaying through an ESP The ESP, after Postfix hands the message over The ESP's records; Postfix itself adds nothing receivers check
Staff mailboxes Microsoft 365 or Google Workspace MX, SPF and DKIM from Microsoft 365 or Google Workspace
Domain that sends no mail Nobody v=spf1 -all and p=reject, as in should parked domains have a DMARC record

DigitalOcean's records guide says SPF and DKIM records are special TXT records created with the TXT option, so they go in the same place as DMARC. SPF sits at @, DKIM at the selector name the sender gives you. A domain can have only one SPF record; see how to create an SPF record and multiple SPF records: how to merge them. For DKIM, follow how to set up DKIM.

To pass DMARC, SPF or DKIM must pass for a domain that aligns with the visible From domain. DMARC alignment explained covers why a passing ESP signature can still fail DMARC.

09

Which DMARC values should you use under RFC 9989?

Start at p=none with a rua address, fix your senders, then publish p=quarantine and later p=reject as whole steps. RFC 9989 replaced RFC 7489 in 2026. It removed pct, ri and rf, added np, psd and t, and replaced the Public Suffix List with a DNS tree walk.

For a cautious first step at a new level, RFC 9989 Section 4.7 defines t=y (testing mode), which asks receivers to apply the next lower policy. Remove t=y once the level is confirmed.

Stage TXT Value at _dmarc
Monitoring v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net
Cautious quarantine v=DMARC1; p=quarantine; t=y; rua=mailto:dmarc-reports@example.net
Quarantine v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.net
Reject v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.net

Change policy by editing the one record. RFC 9989 Section 4.10 says that if multiple DMARC records are returned for a name, they are all discarded. New DMARC tags: np, psd and t explains the new tags, and why partial enforcement was dropped covers what replaced the percentage ramp.

Do you need an RFC 9990 authorisation record for reports?

Yes, when reports go to a domain other than the one publishing the policy. RFC 9990 has receivers check a TXT record at <policy domain>._report._dmarc.<destination host> that starts with v=DMARC1. A reporting provider usually publishes it; see authorising external DMARC report destinations.

10

How do you verify the DMARC record after publishing?

Query _dmarc and confirm that exactly one record starting with v=DMARC1 comes back. Then ask a DigitalOcean name server directly, so a cached answer from a public resolver does not mislead you.

$ dig @ns1.digitalocean.com +short TXT _dmarc.example.com
"v=DMARC1; p=none; rua=mailto:dmarc-reports@example.net"

$ dig +short TXT _dmarc.example.com

On Windows:

nslookup -type=TXT _dmarc.example.com ns1.digitalocean.com
Resolve-DnsName -Name _dmarc.example.com -Type TXT

What the result means:

  • Present at ns1.digitalocean.com, missing in a public lookup. Cached answer or delegation not live yet. Check dig NS and wait for the TTL.
  • Missing at ns1.digitalocean.com too. Wrong Hostname, wrong team, or the record was not saved. Try dig TXT _dmarc.example.com.example.com for a doubled name.
  • Two strings starting with v=DMARC1. Two records exist. Delete one.
  • Value appears at example.com. The Hostname was @. Move it to _dmarc.
  • Quotes inside the value, such as ""v=DMARC1.... Quotation marks were typed into the value. Remove them.

The DMARC checker validates syntax and flags duplicates. How to fix "no DMARC record found" covers the causes of an empty answer.

11

What are the common DigitalOcean DMARC mistakes?

Most problems come from editing a zone that is not delegated, using the wrong Hostname, or creating a second _dmarc record when changing policy.

Symptom Likely cause Fix
Record shows in the panel, dig returns nothing Name servers are not ns1/ns2/ns3.digitalocean.com Fix delegation or add the record at the live DNS host
Policy sits on the root domain Hostname set to @ Recreate with Hostname _dmarc
Record found only at a doubled name Full domain typed into Hostname Delete it and re-add with _dmarc
Checker reports no valid policy Two TXT records at _dmarc, often from a second doctl create or Terraform run Keep one; use edit or update
Value starts with " Quotation marks typed into TXT Value Enter the string without quotes
TTL rejected Below the 30 second minimum Use 30 seconds or more
Domain missing from the Domains tab It lives in another team Switch team in the panel or doctl context
No aggregate reports arrive No rua, or external address not authorised Add rua; publish the RFC 9990 record
DMARC fails for app mail ESP domain not aligned with From Set up the ESP's custom DKIM domain
12

How should MSPs manage client domains in DigitalOcean?

Give each client a separate team and script DMARC changes through the API or doctl instead of sharing logins. DigitalOcean supports custom team roles, scoped API tokens and named doctl contexts, which together let you touch DNS without full account access.

  • Teams and roles. DigitalOcean's custom roles page describes roles that include only the permissions you choose, created in the control panel. The domain:update permission allows modifying domains and records and requires domain:read. Ask each client to add you with a DNS role rather than Owner.
  • Scoped tokens. The personal access token guide offers Custom Scopes as well as Read Only and Full Access. A token with domain:read, domain:create and domain:update is enough for DMARC. Scopes cannot be edited later, and set an Expiration.
  • One context per client. doctl auth init --context saves a token under a name, and any command accepts --context. That lets one script loop over clients safely.
  • Inventory. Run dig NS and dig TXT _dmarc across every client domain, and log each change in a DMARC change-management policy.
  • Offboarding. Revoke tokens and leave the client's team at contract end; tenant offboarding covers handing DMARC back.

A read-only inventory across clients can be as simple as:

for ctx in client-a client-b client-c; do
  for d in $(doctl compute domain list --context "$ctx" --format Domain --no-header); do
    echo "$ctx $d: $(dig +short TXT _dmarc.$d)"
  done
done

DMARC AI collects aggregate reports for every client domain in one multi-tenant view, so after a DigitalOcean change you can confirm reports arrive and each client's senders align before you enforce. Multi-tenant DMARC management explains why per-client separation matters, and DMARC for MSPs covers running it as a service.

13

What are the next steps after publishing p=none?

Collect aggregate reports for a few weeks, fix every legitimate sender that fails alignment, then edit the record to p=quarantine and later p=reject. Each step changes the whole domain at once, because RFC 9989 removed pct. Use t=y if you want receivers to hold back one level while you watch.

  1. Publish p=none with a rua address and confirm reports arrive.
  2. Identify every sending source: the ESP behind your Droplets, mailboxes, CRM and billing tools.
  3. Align SPF or DKIM for each one.
  4. Edit the record to p=quarantine, then to p=reject once reports are clean.
  5. Add np=reject if you want a strict policy for non-existent subdomains; see non-existent subdomains and the np tag.

Moving from monitoring to enforcement safely walks through each step in detail.

14

FAQ

Does DigitalOcean create a DMARC record automatically?

No. A domain added to DigitalOcean starts with NS and SOA records only, and DigitalOcean's DNS docs describe no DMARC automation. Query _dmarc.example.com with dig @ns1.digitalocean.com to see whether a record exists. If not, create a TXT record with Hostname _dmarc in the control panel, with doctl or through the API.

What Hostname does DigitalOcean need for a DMARC record?

Enter _dmarc in the Hostname field of a TXT record. DigitalOcean treats the Hostname as @ for the apex or a prefix, so do not type _dmarc.example.com. For a subdomain such as shop.example.com, enter _dmarc.shop. In doctl use --record-name _dmarc, and in the API set "name": "_dmarc".

Can a Droplet send email that passes DMARC?

Droplets block outbound SMTP ports 25, 465 and 587 by default, and DigitalOcean recommends a third party email service. Mail from a Droplet app normally goes through an ESP, which signs with DKIM. To pass DMARC, configure the ESP to sign with your own domain and publish its SPF and DKIM records in DigitalOcean DNS.

How do I change the DMARC policy without creating a duplicate?

Edit the existing record. In the control panel, use the record's More menu and Edit record. With doctl, run records update with the --record-id; with the API, send PATCH to the record's ID. Creating a second TXT record at _dmarc makes receivers discard both, which switches DMARC off.

What TTL should I use for a DMARC record in DigitalOcean?

Use a short TTL such as 300 seconds while you are testing and changing policy, then raise it if you like. DigitalOcean requires at least 30 seconds for every record. doctl and Terraform default to 1800 seconds when you leave the TTL out, so set it explicitly in scripts.

Related articles

Related tools

Ready to Implement?

Get authenticated mail moving in minutes: start free, book a guided demo, or talk to the team about your stack.