Technical guide

How to Add a Secondary MX Record (With Examples)

Add a secondary (backup) MX record the right way: preference numbers, examples for common DNS panels, mistakes that cause loops and how to test it.

Published · Updated · 4 min read · SecuraWall team, Doz Teknoloji

A secondary MX record tells sending servers where to deliver your mail when your primary mail server does not answer. Adding one takes a few minutes; getting the preference numbers and the delivery target right is what makes it work.

How MX preference works

Every MX record has a preference number. Senders try the lowest number first and move to higher numbers only when the lower ones do not answer. Equal numbers share the load; they do not form a primary and a backup.

example.com.  MX  10  mail.example.com.
example.com.  MX  20  gate.securawall.com.

Here mail.example.com is the primary (10) and gate.securawall.com the secondary (20).

Step by step

  1. Write down your current MX records exactly as they are, including their preference numbers, so you can roll back.
  2. Order the backup MX service and verify that you own the domain (SecuraWall asks for a TXT record).
  3. In your DNS panel, add a new MX record for the domain itself (host "@" or empty) pointing to the backup host, with a number higher than every primary record.
  4. Do not remove or change your primary MX records.
  5. Make sure the backup service knows where to deliver: your real mail server's public address and port, never the backup host itself.
  6. Allow the backup service's sending addresses through your firewall to your mail server's SMTP port.
  7. Wait for DNS to update, then test with a controlled outage.

Examples for common setups

One on-premises server with a backup:

example.com.  MX  10  mail.example.com.
example.com.  MX  30  gate.securawall.com.

Two primary servers that share the load, plus a backup after both:

example.com.  MX  10  mx1.example.com.
example.com.  MX  10  mx2.example.com.
example.com.  MX  50  gate.securawall.com.

Many DNS panels ask for "Priority" in a separate field and the host name without the trailing dot; the meaning is the same.

Mistakes that break mail

  • Giving the backup the lowest number: senders then deliver everything to the backup first, which is not what a secondary MX is for.
  • Pointing the backup's delivery target back to the backup: mail loops until it bounces. The target must be your real server.
  • Firewall rules that only allow the old route: the backup must be able to reach your server's SMTP port, or the queue never empties.
  • An MX that points to an IP address or a CNAME: MX targets must be host names with A or AAAA records.
  • Forgetting the record when changing providers: an old backup MX that still accepts mail for your domain can hold messages you never see.

How to test it

In a maintenance window, stop your mail server's SMTP service or block port 25 from outside. Send a message from an external mailbox: it should appear as waiting in the backup's queue. Start your server again and confirm that the message arrives and the queue empties. A lookup tool showing your MX records proves only that DNS is right, not that delivery works.

Frequently asked questions

Which number should the secondary MX have?

Any number higher than all your primary records. If your primary uses 10, 20 or 30 is common.

Do I need a secondary MX with Microsoft 365 or Google Workspace?

Usually not; both run redundant receiving infrastructure. A secondary MX matters when your own server or gateway receives the mail.

Does a secondary MX change my SPF record?

No. SPF lists servers that send mail for your domain; a backup MX only receives. Add it to SPF only if it also relays your outgoing mail.

References

Protect your domain this week.

No commitment, no auto-renewal. One MX change to start; to leave, point your MX back.

Multi-layer email security with dual-layer AI, monthly per domain.

Protect your domain
Technical support