How to Configure MX Records for Email Delivery

MX (Mail Exchange) records tell the internet which servers handle incoming email for your domain. Misconfigured MX records are one of the most common reasons incoming email simply never arrives.

Understanding MX Record Priority

Each MX record has a priority number — lower numbers are tried first. Multiple MX records provide redundancy: if the primary server is unreachable, mail is delivered to the next-priority server.

Priority 10: mail.yourdomain.com
Priority 20: mail-backup.yourdomain.com

Scenario 1 — Self-Hosted Mail Server

If you're running your own mail server on your VPS (see How to Install and Configure Postfix as a Mail Transfer Agent):

Type: MX
Name: @
Priority: 10
Value: mail.yourdomain.com
TTL: 3600

Ensure a corresponding A record exists for mail.yourdomain.com pointing to your VPS's IP.

Scenario 2 — Using a Third-Party Email Service

If you're using a hosted email provider instead of self-hosting, use the exact MX records they specify in their setup documentation — these vary by provider and are typically provided as a specific list to copy exactly.

Step-by-Step: Adding an MX Record

  1. Log in to your DNS management panel
  2. Add a new record, selecting type MX
  3. Set Name to @ (or a subdomain, if using subdomain-based email)
  4. Enter the mail server hostname as the value
  5. Set the priority number
  6. Save

Verifying MX Records

dig MX yourdomain.com +short

Common Mistakes

  • Using an IP address as the MX value instead of a hostname — MX records must point to a hostname, which itself must resolve via an A record
  • Forgetting the corresponding A record for the mail server hostname
  • Leaving old MX records from a previous email provider active alongside new ones, causing routing conflicts
  • Not setting SPF/DKIM/DMARC alongside MX — MX alone doesn't authenticate outbound mail; see How to Configure SPF, DKIM, and DMARC

Testing Incoming Mail Delivery

Send a test email from an external account (Gmail, Outlook) to an address at your domain, then confirm it arrives and check headers if it doesn't.

Common Errors

Email bounces with "mailbox unavailable" or similar — often not an MX issue but a mailbox configuration problem on the receiving server; verify the mail server itself is running and configured for that domain.

"No MX record found" — the record wasn't saved, or hasn't propagated yet; verify with dig MX.

Mail delivered inconsistently — check if multiple conflicting MX records exist from different providers/setups.

Best Practices

  • Always pair MX records with proper SPF, DKIM, and DMARC configuration
  • Remove old MX records completely when switching email providers, don't just add new ones alongside
  • Use a dedicated mail subdomain (mail.yourdomain.com) rather than the bare root domain as the MX target

Related Articles

  • How to Install and Configure Postfix as a Mail Transfer Agent
  • How to Configure SPF, DKIM, and DMARC (Complete Guide)
  • DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained
  • mx record, email dns, mail server dns, dns configuration
  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained

DNS translates human-readable domain names into the information servers actually need — IP...

How to Point a Domain to Your VPS (A/AAAA Records)

Before your website is reachable at yourdomain.com instead of a raw IP address, you need to...

How to Use CNAME Records Correctly

CNAME records let you alias one domain name to another, but they come with important restrictions...

How to Enable and Configure IPv6 on Your VPS

IPv6 adoption continues to grow, and many VPS plans include a free IPv6 address alongside IPv4....

How to Configure a Static IP on a Linux VPS

Most VPS providers assign a static (unchanging) IP address by default, but understanding how...