Setting Up DNS Records for Email: A Step-by-Step Guide
Properly configuring DNS records is essential for email delivery. Whether you're setting up a new mail server or migrating to a new email host, you need four types of DNS records: MX, SPF, DKIM, and DMARC. Here's how to set up each one.
Step 1: MX Records (Mail Exchange)
MX records tell other mail servers where to deliver email for your domain. Without them, no one can send you email.
yourdomain.com MX 10 mail.yourdomain.com
The number (10) is the priority. Lower numbers have higher priority. If you have multiple mail servers, use different priorities for failover.
Step 2: SPF Record (Sender Policy Framework)
SPF tells receiving servers which IPs are authorised to send email for your domain. It's a TXT record on your root domain.
yourdomain.com TXT "v=spf1 mx include:_spf.yourprovider.com -all"
Key rules:
- You can only have one SPF record per domain
mxauthorises your MX serversinclude:authorises third-party senders-allmeans reject all other senders (recommended)- Keep DNS lookups under 10 to avoid SPF failures
Step 3: DKIM Record (DomainKeys Identified Mail)
DKIM adds a cryptographic signature to your emails. You need to publish the public key in DNS. Your email provider will give you the specific record.
selector._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."
The selector is unique to your provider (e.g., netcob, google, mail). Your provider will tell you exactly what to use.
Step 4: DMARC Record
DMARC ties SPF and DKIM together with a policy and enables reporting.
_dmarc.yourdomain.com TXT "v=DMARC1; p=reject; rua=mailto:dmarc@yourdomain.com"
Start with p=none (monitoring mode) if you're not confident in your setup. Move to p=quarantine and then p=reject once you've confirmed everything works.
Provider-Specific Instructions
Cloudflare
- Log in to the Cloudflare dashboard
- Select your domain → DNS → Records
- Click "Add record" for each record type
- For MX: Set Name to
@, Content to your mail server, Priority as specified - For TXT records: Set Name to
@(SPF/DMARC) or the specific subdomain (DKIM)
GoDaddy
- Go to My Products → DNS → Manage
- Under Records, click "Add" for each record
- Select the record type (MX or TXT)
- Enter the host, value, and priority as specified
Namecheap
- Log in → Domain List → Manage → Advanced DNS
- Click "Add New Record"
- Select the type and enter the host and value
Verifying Your Setup
After adding your DNS records, verify them using these tools:
- MXToolbox: Check MX, SPF, DKIM, and DMARC records
- dig command:
dig TXT yourdomain.comto check SPF - Mail-tester.com: Send a test email and get a deliverability score
DNS changes can take up to 48 hours to propagate, though most complete within 1-4 hours.
Skip the DNS hassle
Netcob's guided setup wizard tells you exactly which records to add, and auto-configures them if your domain is on Cloudflare.
Start Free Trial →