When a mail server has a message for someone@example.com, it looks up the MX records of example.com. Each record has a preference value and a hostname. The sender tries the host with the lowest number first and moves on to higher numbers only if that fails; hosts with equal numbers share the load.
The target of an MX record must be a hostname with its own A or AAAA record, not an IP address and not a CNAME. If a domain has no MX record at all, senders fall back to the domain's A or AAAA record. A domain that should never receive mail can say so explicitly with a "null MX": a single record with preference 0 and "." as the target.
MX records only control where incoming mail is delivered. Whether the mail a domain sends is trusted depends on SPF, DKIM and DMARC, which live in TXT records.
Example
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.