Nodemailer in strapi4

Hi, I try to use Nodemailer in strapi4, but I don’t find any doc or tuto that work… It was working fine in strapi3 for me… Anyone used it with success ?

I’m using it successfully in version 4.1.3.
I was struggling to make it work following the offical package readme.

The problem was that I was using only this file as described on the readme.

config/env/development/plugins.js

module.exports = ({ env }) => ({
  email: {
    provider: 'nodemailer',
    providerOptions: {
      host: 'localhost',
      port: 1025,
      ignoreTLS: true,
    },
  },
});

But if using it alone, without the main config/plugins.js, you must nest a config object on it.

module.exports = ({ env }) => ({
  email: {
    config: {
      provider: "nodemailer",
      providerOptions: {
        host: "localhost",
        port: 1025,
        ignoreTLS: true,
      },
      settings: {
        defaultFrom: "DEFAULT EMAIL",
        defaultReplyTo: "DEFAULT MAIL",
      },
    },
  },
});

Hello

I cannot make it work on.

I created a repo to reproduce the error :

The consistent I get with maildev config or production smtp server is

error: Couldn’t send test email: can not connect to any SMTP server.
Error: Couldn’t send test email: can not connect to any SMTP server.

If anyone can help, it would be greatly appreciated.

Thanks

Bobby