Any domain that uses email has MX (Mail eXchanger) records. The MX record lists the various mail servers available to accept mail for that domain. Lets use spamtitan.com as an example.
The domain spamtitan.com has two MX records (these are just an example and are not actual MX records):
Domain TTL Type Priority Server
spamtitan.com. 3250 IN MX 10 server1.spamtitan.com.
spamtitan.com. 3250 IN MX 20 server2.spamtitan.com.
The priority determines which record should be used first, starting with the lowest (e.g. 10 will be used before 20). If that is not available then next server is contacted and so on. You can use MX records of equal priority to allow both servers to be used equally, this is useful if you are using a SpamTitan cluster as it will distribute mail evenly between your servers.
This MX record tells us that if you want to send mail to spamtitan.com you first contact server1.spamtitan.com, and if it is not available the use server2.spamtitan.com. server1.spamtitan.com is an A record which resolves a name to an IP address:
FQDN TTL Type IP address
server1.spamtitan.com. 8488 IN A 188.8.131.52
We now have an IP address that we can use to contact the mail server directly and deliver email for spamtitan.com.
So the sequence is:
MX Record-> A Record-> IP Address