dnsmx 1 user commands djbwares
dnsmx look up the mail exchanger records of a domain name
`dnsmx` fqdn

## Description

`dnsmx` looks up the `MX` resource records for fqdn in the Domain Name System, and prints them. If there are no `MX` resource records, `dnsmx` prints an artificial `MX` record, simulating the behavior of MTAs.

Normally `dnsmx` exits 0. If it encounters a temporary problem that prevents it from determining the `MX` resource records, it prints an error message and exits 111.

`dnsmx` makes all DNS lookups using the locally configured DNS proxy server(s), and performs no name qualification on what is taken to already be a "fully-qualified" domain name (trailing dot or no) fqdn. See djbdns-client 5 for how this server is found, and for certain standard domain names that short-circuit DNS lookups to the proxy DNS server(s).

fqdn can take the appearance of the human-readable form of a (legal and well-formed) IPv4 address. However, it is always considered to be a domain name and passed to the locally configured proxy DNS server(s) for lookup. dnscache 1 filters queries for such names and synthesizes fixed responses to them that list no `MX` resource records. Other proxy DNS servers rely upon the fact that the public "`.`" content DNS servers state that these domains do not exist, and generate bogus traffic to those servers.

## History

`dnsmx` was originally part of Daniel J. Bernstein's djbdns toolset in 1999.

## Author

Original code and documentation by Daniel J. Bernstein. Documentation modernizations by Jonathan de Boyne Pollard.