Suped

What SPF mechanism references the mail exchanger records?

When you're setting up email authentication, you'll quickly come across Sender Policy Framework, or SPF. It's a crucial part of the DMARC, SPF, and DKIM trio that protects your domain from being used for phishing and spam. At its core, an SPF record is a simple text entry in your domain's DNS that lists all the servers authorized to send email on your behalf.

kinsta.com logo
Kinsta® says:
Visit website
An SPF record is a DNS TXT record containing a list of all the authorized mail servers for your website. Learn how to use SPF records here.

To create this list of authorized senders, SPF uses different components called "mechanisms". Each mechanism provides a different way to identify a valid sending server. The question here is about which of these mechanisms specifically uses your domain's mail exchanger (MX) records, and the answer is quite straightforward.

Suped DMARC monitor
Free forever, no credit card required
Get started for free
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

The mx mechanism

The SPF mechanism that references a domain's mail exchanger records is, simply, the mx mechanism. When a receiving email server sees the mx mechanism in your SPF record, it understands that all the servers listed in your domain's MX records are permitted to send email for you.

www.duocircle.com logo
DuoCircle says:
Visit website
The “MX” mechanism: The sending IP address, which matches the MX record of the “from” domain, will pass the SPF check. Every domain hosting emails contains more…

How does the mx mechanism work?

The process a mail server follows when it encounters an mx mechanism is a logical sequence of DNS lookups. It's designed to confirm that the sending server is one of the designated mail exchangers for the domain.

  • A receiving server gets an email claiming to be from your domain.
  • It finds your domain's SPF record in the DNS.
  • It reads the record and finds the mx mechanism.
  • The server then looks up the MX records for your domain.
  • For each MX record (e.g., mail.example.com), it looks up the corresponding IP addresses (A or AAAA records).
  • It checks if the sending email server's IP address is in the list it just collected. If it is, the email passes the check.

Why and when to use the mx mechanism

The primary benefit of the mx mechanism is convenience. It's particularly useful if you send emails from the same servers that handle your incoming mail. This is a common configuration, especially for businesses that host their own mail servers.

By using mx, you don't have to explicitly list the IP addresses of your mail servers in your SPF record. If you ever change the IP address of a mail server, you only need to update your DNS A record for that server; your SPF record automatically stays current. It simplifies management and reduces the chance of errors.

www.techtarget.com logo
Search Security says:
Visit website
MX refers to the DNS MX or mail exchange record type. This mechanism is used to specify a domain or subdomain, and the receiving mail server ...

An example SPF record using mx

A basic but effective SPF record for a domain that sends email from its mail exchangers looks like this:

v=spf1 mx -all

  • v=spf1: This simply states the SPF version. It must be at the start of the record.
  • mx: This is our mechanism. It authorizes all the IP addresses of the servers listed in the domain's MX records.
  • -all: This part tells receiving servers that any sender not explicitly authorized by the preceding mechanisms should be treated as a failure (a "hard fail"). This is critical for preventing spoofing.

A word of caution: the DNS lookup limit

While the mx mechanism is useful, it has one major consideration: the SPF DNS lookup limit. According to the official specification, an SPF check for a single email cannot generate more than 10 DNS-querying mechanisms. The mx mechanism itself consumes at least two lookups, one for the MX records and another for the A record of each hostname found. If your domain has several MX records, you can quickly approach the limit. Exceeding this limit will cause your SPF record to fail validation, harming your email deliverability. Always be mindful of this limit when constructing your SPF record.

Start improving your email deliverability today

Get started