Unauthenticated email from strapi.io is not accepted due to domain's 550-5.7.26 DMARC policy

If anyone is coming to this question from Google, here is what works for a default installation:

Suppose your Strapi is running on strapi.mydomain.com.

Edit (or create if necessary) the file config/plugins.js and put this code inside:

module.exports = {
   // here might be other things already, but add the next part
   email: {
     config:{
      provider: 'sendmail',
      providerOptions: {},
      settings: {
          defaultFrom: 'email@strapi.mydomain.com',
      },
    },
  }
}

This is necessary to have the correct “From” address set.

Then go to this tool SPF Record Generator - MxToolBox and fill the fields:

  • Do you send email from your webserver? => Yes
  • Enter any other server hostname or domain that delivers email for your domain => (your domain name, e.g. strapi.mydomain.com)
  • Enter your domain’s IPv4 Addresses / CIDR Ranges => Your server’s IP4 address (e.g. 12.34.56.78)
  • Enter your domain’s IPv6 Addresses / CIDR Ranges => Your server’s IP6 address (e.g. 1222::2:323)
  • How strict should should the SPF Policy be? => Strict

Then copy the value of the suggested record and put it as the value of a new TXT DNS record for your domain. So for the DNS record put type=TXT, key/domain gets set to your subdomain or empty or @ if Strapi runs directly on mydomain.com, then for the value the one from the mxtoolbox website.

Now email sending should work! It might still land in the spam folder, but there’s not much you can do further.

2 Likes