Domain Email and DNS Records Explained: Set Up SPF, DKIM, DMARC, and MX Correctly
domain emailSPFDKIMDMARCMX recordsemail deliverability

Domain Email and DNS Records Explained: Set Up SPF, DKIM, DMARC, and MX Correctly

WWebhost.link Editorial Team
2026-11-14
7 min read

A practical guide to MX, SPF, DKIM, and DMARC records, with setup checklists and troubleshooting steps for reliable domain email.

Reliable domain email depends on several DNS records working together. This guide explains SPF, DKIM, DMARC, and MX records in plain language, then provides a provider-neutral checklist for configuring them on shared hosting, VPS, cloud infrastructure, or a separate email platform. Use it when launching a domain, changing hosts, adding a sending service, or investigating delivery failures.

Overview

DNS records tell the internet where a domain’s services are located and which systems are permitted to use the domain. For email, the most important records are MX, SPF, DKIM, and DMARC. They have different jobs, so adding one record does not replace the others.

RecordPurposeTypical location
MXIdentifies the mail servers that receive messages for the domain.DNS zone for the domain
SPFLists servers and services authorized to send mail using the domain.TXT record at the domain root
DKIMUses a cryptographic signature to help recipients verify that an authorized system sent the message.TXT or CNAME record at a provider-supplied selector
DMARCDefines how recipients should handle messages that fail authentication and where reports should be sent.TXT record under _dmarc

The exact values come from your email provider, not your web host by default. A VPS or cloud server may host the website while another provider handles mail. Conversely, a single hosting account may handle both. Map every system that sends mail before editing DNS, including contact forms, transactional email, marketing platforms, support tools, monitoring systems, and application servers.

DNS changes are made wherever the domain’s authoritative nameservers are managed. That may be the registrar, a DNS provider, or a hosting control panel. Confirm the correct DNS authority first; editing records in the wrong dashboard will not change the live zone.

Checklist by scenario

When setting up a new domain email service

  1. Record the provider’s required MX hostnames and priorities.
  2. Replace old MX records only after confirming that the new service is ready to receive mail.
  3. Add the provider’s SPF mechanism to the single SPF record for the domain.
  4. Generate or enable DKIM in the provider’s administration panel, then publish the supplied TXT or CNAME record.
  5. Add a DMARC record, initially with a monitoring policy such as p=none while legitimate senders are identified.
  6. Create test mailboxes and test both inbound and outbound messages.

When the website is on a VPS or cloud server

  1. Decide whether the server sends application mail directly or relays through an email provider.
  2. Include only the actual sending service in SPF; do not authorize an entire cloud provider unless its documentation specifically requires that approach.
  3. Configure DKIM signing at the mail server or relay and publish the matching public key.
  4. Use a valid reverse-DNS or hostname configuration where required by the mail system, while remembering that reverse DNS does not replace SPF, DKIM, or DMARC.
  5. Check application settings so the visible From address matches the domain you intend to authenticate.

When adding a contact form, newsletter, or transactional sender

  1. List the new sender alongside existing services before changing SPF.
  2. Follow the sender’s DKIM setup instructions and use a distinct selector when appropriate.
  3. Decide whether the service should send from your main domain or a dedicated subdomain, such as mail.example.com.
  4. Test alignment: the authenticated domains should relate appropriately to the visible From domain under your DMARC policy.
  5. Review DMARC reports after the change for unknown sources, forwarding behavior, and unexpected failures.

When moving hosting or changing DNS providers

  1. Export or document the current DNS zone before migration.
  2. Copy MX, SPF, DKIM, DMARC, verification, and subdomain records, not only the website’s A or AAAA record.
  3. Lowering TTL before a planned change can help reduce waiting time, but it does not eliminate caching.
  4. Keep the old mail service available until the new MX records are active and tested.
  5. Check the domain from outside the hosting account after nameserver changes.

For a broader infrastructure move, pair this checklist with the website migration checklist. Email often fails during migrations because it is treated as an afterthought.

What to double-check

SPF format and duplication

SPF is published as a TXT record, normally at the root of the domain. A domain should have one effective SPF policy. Multiple separate TXT records beginning with v=spf1 can cause an SPF permerror rather than combining cleanly. Merge authorized mechanisms into one provider-approved policy, and remove services that no longer send mail. Avoid copying arbitrary IP ranges or including providers you do not use.

DKIM selector and key matching

DKIM records are selector-specific. If the provider gives you a selector named selector1, the record belongs at selector1._domainkey.example.com, not at the domain root. A common failure is publishing the right key under the wrong hostname, adding quotation marks incorrectly in a control panel, or leaving an old CNAME in place after rotating keys. Use the provider’s exact hostname and value.

DMARC policy and alignment

A basic DMARC record resembles v=DMARC1; p=none; rua=mailto:dmarc@example.com, but the address and policy should match your monitoring plan. Start in reporting mode while all legitimate senders are being identified. After reviewing reports and correcting failures, consider a stricter policy such as quarantine or reject. Increase enforcement deliberately, especially if the domain sends from several applications or relies on forwarding.

DMARC evaluates alignment, not merely whether SPF or DKIM passes. A message may pass SPF for a vendor’s own envelope domain while failing alignment with the visible From domain. DKIM can provide alignment when the signing domain corresponds to the From domain. Check the provider’s setup instructions and inspect authentication results in test messages.

MX priorities and delivery paths

MX priority numbers indicate preference; the lower number is generally tried first. Do not add backup MX records unless you know who operates them and how they queue mail. An incorrect or stale MX record can route mail to an old host, create delays, or make a mailbox appear empty even though messages were accepted elsewhere.

Common mistakes

  • Changing nameservers and forgetting email records: A new DNS zone may contain only website records. Recreate mail records before switching authority.
  • Publishing two SPF policies: Combine mechanisms into one policy instead of adding a second v=spf1 TXT record.
  • Using a web host’s default mail settings after moving mail: Remove obsolete MX records and update application SMTP settings.
  • Putting the DMARC record at the wrong name: It belongs at _dmarc.example.com.
  • Assuming DNS changes are immediate: Cached results can persist according to TTL, and different resolvers may update at different times.
  • Enforcing DMARC before inventorying senders: Legitimate invoices, password resets, or form notifications may be rejected if their service is not configured for alignment.
  • Testing only from one mailbox: Test inbound delivery, outbound authentication, replies, forwarding, and messages from each important sending system.

When diagnosing a failure, collect the complete message headers, identify the receiving provider’s authentication results, and compare them with the published DNS values. Testing tools can reveal syntax and lookup issues, but provider documentation and real message headers are the final reference for your configuration.

When to revisit

Review domain email DNS whenever you change hosting, nameservers, registrars, email providers, VPS software, cloud applications, contact forms, marketing tools, or transactional senders. Also revisit it after a domain transfer, a DKIM key rotation, a mail outage, a sudden increase in spam placement, or reports of bounced legitimate messages. Domain renewal deserves attention too: an expired domain can affect both the website and its mail routing, as explained in this domain expiration and renewal guide.

Keep a simple, dated inventory containing the authoritative DNS provider, MX destinations, the single SPF policy, DKIM selectors, DMARC policy, sending applications, and the person or team responsible for each service. Recheck the inventory before seasonal planning cycles or major campaigns, and whenever workflows or tools change.

For a practical final check, send a message from every legitimate application, inspect the headers for SPF and DKIM results, confirm DMARC alignment, verify that replies arrive in the intended mailbox, and monitor reports after each change. If the website and mail infrastructure are becoming more complex, compare operational trade-offs in shared hosting, VPS, and cloud hosting before deciding where each service should run.

Related Topics

#domain email#SPF#DKIM#DMARC#MX records#email deliverability
W

Webhost.link Editorial Team

Technical Hosting Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.