Suped

What SPF mechanism includes the MX records of a domain?

The short answer is the mx mechanism. In a Sender Policy Framework (SPF) record, you can use several different types of mechanisms to specify which servers are authorized to send email on behalf of your domain. The mx mechanism is specifically designed to approve any sending server that is also listed as a mail exchanger (MX) in your domain's DNS records.

As SiteGround explains, when you add the mx mechanism to your SPF record, all the servers defined in your domain's MX records are automatically added to the approved senders list. This is particularly useful if the same servers handle both your incoming and outgoing email.

autospf.com logo
AutoSPF says:
Visit website
In SPF, the 'mx' mechanism tells the receiving servers that it allows any server listed in the sending domain's MX record to send emails on its behalf.
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

How does the `mx` mechanism function?

When a recipient's mail server receives an email, it checks the SPF record of the sender's domain to verify the email's authenticity. If this SPF record contains the mx mechanism, the server performs a series of DNS lookups. First, it queries the MX records for the domain in the SPF record. Then, for each MX record found, it looks up its corresponding IP address (or addresses). If the IP address of the server that sent the email matches one of these IP addresses, the SPF check passes for this mechanism.

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...

Syntax and examples of the `mx` mechanism

The syntax for the mx mechanism is quite straightforward. It can be used in two primary ways in your SPF record:

  • Standalone mx: If you simply use mx, it directs receiving servers to check against the MX records of the current domain. For example: v=spf1 mx ~all
  • Targeted mx:domain.com: You can also specify a different domain. The mechanism mx:example.com tells receiving servers to look up the MX records for example.com instead of the domain where the SPF record resides. This might be used in more complex sending scenarios. For example: v=spf1 mx:email-provider.com ~all

When should you use the `mx` mechanism?

The mx mechanism is ideal for simpler email setups where the same servers are responsible for sending and receiving mail. It avoids having to list IP addresses explicitly, which can be helpful if those IPs change.

However, it's important to be aware of the SPF 10 DNS lookup limit. Each mx mechanism consumes at least one DNS lookup to find the MX records, and then additional lookups for the IP addresses associated with them. As noted in a discussion on the GCA Community, this can quickly add to your total lookup count. If your SPF record is already complex with multiple include statements, adding an mx mechanism could push you over the limit, causing validation issues.

community.globalcyberalliance.org logo
GCA Community says:
Visit website
It seems clear that a mx mechanism in the SPF record adds one to the DNS count but it is less clear (to me) if querying the DNS to find the...

For this reason, if you use a third-party email provider like Google Workspace or Microsoft 365, it is almost always better to use their recommended include mechanism (e.g., include:spf.protection.outlook.com) rather than the mx mechanism. The include is managed by the provider and is optimized for deliverability and the lookup limit.

Start improving your email deliverability today

Get started