GoAdmio

checkmx

Check every hosted domain for a missing MX record or an unexpected MX priority

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

A domain needs an MX record in its DNS zone to receive email. /go/checkmx goes through every hosted domain and reports two problems:

The command only reports. It does not change DNS. Use mx to add or fix a record.


Quick start

/go/checkmx

Syntax

/go/checkmx

The command takes no options or arguments. If you run it without root, it re-runs itself with sudo. It needs dig (the dnsutils package).


Options

None. Any arguments you pass are ignored. The command checks every folder in /home that has a www folder.


Output

Each problem is printed on its own line, in red. The command prints nothing when all domains pass.

Message Meaning
No MX Record: Please add MX for domain <domain> The main domain has no MX record.
Invalid MX priority (<n>): Please change MX priority to 0 for domain <domain> The domain has one MX record, and its priority is <n> instead of 0 or 1.

Each run also adds a line to /var/log/go/checkmx.log.


Examples

# Check all domains
/go/checkmx
# Look at a domain's MX records yourself
dig +noall +answer -t mx example.com
example.com.  3600  IN  MX  10 mail.example.com.

In this example the single record has priority 10, so checkmx reports it.


Troubleshooting

Symptom Likely cause Fix
No MX Record The domain has no MX record, or the DNS zone is not hosted where the server looks. Add one with mx, then run the command again.
Invalid MX priority The only MX record has a priority other than 0 or 1. Change the priority to 0, for example with mx.
A domain is not reported even though it has a problem It is a subdomain with no MX, or it has two or more MX records. Neither is checked. Check these domains with dig.
A fixed record is still reported The resolver on this server still has the old answer. Wait for the record's TTL to pass, then run again.
dig: command not found The DNS tools are not installed. Install the dnsutils package.
MX records for Google Workspace or Zoho These services use several records, which are not checked. Use google or zoho to add them.

Details

What it checks

For each domain, the command counts the answers of an MX query and then decides:

Number of MX records Check
0 If the domain is a main domain, prints No MX Record. Subdomains are skipped.
1 If the priority is not 0 or 1, prints Invalid MX priority.
2 or more Not checked.

A domain with one dot (example.com) is a main domain. For longer names, known two-part endings such as .co.uk are removed first, and the name is a subdomain if a dot is left.

Known issues


See also

Command Description
mx Add an MX record to a domain through Cloudflare
google Add Google verification and Workspace DNS records via Cloudflare
zoho Configure Zoho mail integration (MX, SPF, DKIM)
dns Add your domain to Cloudflare and edit the DNS zone
spf Add or refresh the SPF TXT record via Cloudflare
troubleshoot Troubleshoot email problems in GoAdmio