Documentation is WRONG! | How to set defaultFrom for strapi email plugin | Set strapi email plugin config | Change strapi email plugin default provider

is not true! Providing a file under /config/plugin.js does not change the email provider!

In order to change the defaultFrom or defaultReplyTo or anything else, you need to put following code inside the register function found in “./src/index.ts”

should look like this:


register(/*{ strapi }*/) {

    strapi.config.set('plugin.email', {

      provider: 'strapi-provider-email-smtp',

      providerOptions: {

        host: ('MAIL_HOST'), //SMTP Host

        port: 465, //SMTP Port

        secure: true,

        username: `${('MAIL_USERNAME')}@${('MAIL_DOMAIN')}`,

        password: ('MAIL_PASSWORD'),

        rejectUnauthorized: true,

        requireTLS: true,

        connectionTimeout: 1,

      },

      settings: {

        defaultFrom: `${('MAIL_USERNAME')}@${('MAIL_DOMAIN')}`,

        defaultReplyTo: `${('MAIL_USERNAME')}@${('MAIL_DOMAIN')}`,

      }

    })

  }

this will work! If you do this, the provider will change, you can see the changes under http://localhost:1337/admin/settings/email

2 Likes

Please open a issue for this on the strapi docs repo on github

1 Like

Have you opened an issue for this?

i am sorry, i currently dont have the time to manage a issue on github. i just posted it here, so if people have the same hassel, maybe someone will find my post, fix it and carry on.

The documentation is correct you use the worng config you set it in the global strapi config witout down to the plugin scope I think I will add an exmaple tommorow if I do not forget

it would be awsome to see how the docs implantaion work’s! my team could’nt get it to run, using the inscrution from the docs

Mind just opening a quick issue on the docs linking to example that is wrong?