TECH / Servers & Websites 3 min read

How to Fix “lowest numbered MX record points to local host” Mail Error

Antonio NEMCD Author
Published Jun 23, 2012 · 3 min

If emails get stuck in your mail server queue (Exim or Sendmail) with the log message lowest numbered MX record points to local host – or the equivalent mail for example.com loops back to myself in Postfix – your mail transfer agent has hit a mail routing loop.

lowest numbered MX record points to local host error in mail server logs

The message means exactly what it says: DNS reports that the highest-priority (lowest-numbered preference) MX record for the destination domain points to your own server’s IP address, yet the mail daemon does not recognize that domain as local and tries to relay the message outbound – straight back to itself.

Scenario 1. Mail for This Domain Should Be Delivered Locally

Most commonly, you pointed the domain’s MX record to the server (or configured a relay) but forgot to add the domain name to your MTA’s local domains list:

  • Exim (FreeBSD / Linux): check the domainlist local_domains directive in your Exim config. It usually reads from a file such as /usr/local/etc/exim/local_domains or /etc/exim4/local_domains – add the domain on a new line and run service exim reload.
  • Exim on cPanel / WHM servers: make sure the domain is listed inside /etc/localdomains and removed from /etc/remotedomains (or in cPanel → Email Routing, select “Local Mail Exchanger”).
  • Sendmail: add the domain (one per line) to /etc/mail/local-host-names and restart Sendmail.
  • Postfix: add the domain to mydestination (or your virtual_mailbox_domains table) in /etc/postfix/main.cf and run systemctl reload postfix.

Scenario 2. Mail Is Hosted Externally (Google Workspace, Microsoft 365, etc.)

The opposite situation often happens on a web server that only hosts a website (for example, WordPress sending contact form alerts to [email protected]) while actual mailboxes live on an external mail provider:

  • Check MX records in DNS: run dig MX example.com +short (or drill MX example.com) on the server itself. If the MX record still points to your web server’s hostname or IP, update the MX records at your DNS provider to point to your external mail host.
  • Check /etc/hosts and local DNS zones: sometimes public DNS is already updated, but a stale entry inside /etc/hosts or a local DNS zone on the server still maps mail.example.com to 127.0.0.1 or the server’s own IP.
Flushing frozen messages in Exim: once you fix local_domains or the MX record, force Exim to retry frozen messages in the queue immediately with exim -qff (check the current queue with exim -bp).

The rule of thumb is simple: if the domain’s MX points to your server, the domain must be in local_domains; if mailboxes live elsewhere, the MX record (as resolved from inside the server) must never point to a local IP.

Related posts:

Leave a Comment