Skip to main content
How to add SPF for Email in Office 365
Updated over a year ago

Create or update your SPF TXT record

  1. Ensure that you're familiar with the SPF syntax in the following table.

    ElementIf you're using...Common for customers?Add this...1Any email system (required)Common. All SPF TXT records start with this valuev=spf12Exchange OnlineCommoninclude:spf.protection.outlook.com3Exchange Online dedicated onlyNot commonip4:23.103.224.0/19
    ip4:206.191.224.0/19
    ip4:40.103.0.0/16
    include:spf.protection.outlook.com4Office 365 Germany, Microsoft Cloud Germany onlyNot commoninclude:spf.protection.outlook.de5Third-party email systemNot commoninclude:<domain_name>

    <domain_name> is the domain of the third-party email system.

    6On-premises email system. For example, Exchange Online Protection plus another email systemNot commonUse one of these for each additional mail system:

    ip4:<IP_address>
    ip6:<IP_address>
    include:<domain_name>

    <IP_address> and <domain_name> are the IP address and domain of the other email system that sends mail on behalf of your domain.

    7Any email system (required)Common. All SPF TXT records end with this value<enforcement rule>

    This can be one of several values. We recommend the value -all.

  2. If you haven't already done so, form your SPF TXT record by using the syntax from the table.

    For example, if you are hosted entirely in Office 365, that is, you have no on-premises mail servers, your SPF TXT record would include rows 1, 2, and 7 and would look like this:

    textCopy

    v=spf1 include:spf.protection.outlook.com -all

    The example above is the most common SPF TXT record. This record works for just about everyone, regardless of whether your Microsoft datacenter is located in the United States, or in Europe (including Germany), or in another location.

    However, if you bought Office 365 Germany, part of Microsoft Cloud Germany, you should use the include statement from line 4 instead of line 2. For example, if you are hosted entirely in Office 365 Germany, that is, you have no on-premises mail servers, your SPF TXT record would include rows 1, 4, and 7 and would look like this:

    textCopy

    v=spf1 include:spf.protection.outlook.de -all

    If you're already deployed in Office 365 and have set up your SPF TXT records for your custom domain, and you're migrating to Office 365 Germany, you need to update your SPF TXT record. To do this, change include:spf.protection.outlook.com to include:spf.protection.outlook.de.

  3. Once you have formed your SPF TXT record, you need to update the record in DNS. You can only have one SPF TXT record for a domain. If an SPF TXT record exists, instead of adding a new record, you need to update the existing record. Go to Create DNS records for Office 365, and then select the link for your DNS host.

  4. Test your SPF TXT record.

Did this answer your question?