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",
},
},
},
});
bobby
July 19, 2022, 6:25am
3
Hello
I cannot make it work on.
opened 12:22PM - 18 Jul 22 UTC
closed 01:17PM - 18 Jul 22 UTC
status: can not reproduce
## Bug report
### Required System information
- Node.js version: v14.17.1
…
- NPM version: 6.14.15
- Strapi version: 4.2.3
- Database: sqlite
- Operating system: OS X 12.4
### Describe the bug
I'm quite new to Strapi. I tried to configure nodemailer to send email via smtp.
### Steps to reproduce the behavior
1. Install nodemailer provider [Doc](https://github.com/strapi/strapi/tree/master/packages/providers/email-nodemailer)
`npm install @strapi/provider-email-nodemailer --save`
2. Configure the plugin.js for local development
<img width="475" alt="CleanShot 2565-07-18 at 19 15 30@2x" src="https://user-images.githubusercontent.com/479162/179509165-86d4e180-ea1c-4bf5-ae56-701ab08f0eaa.png">
3. Start MailDev via Docker
`docker run -p 1080:1080 -p 1025:1025 maildev/maildev`
<img width="637" alt="CleanShot 2565-07-18 at 19 02 54@2x" src="https://user-images.githubusercontent.com/479162/179509269-6bfb17b5-c123-41f4-a74b-20da654ea683.png">
<img width="1171" alt="CleanShot 2565-07-18 at 19 01 25@2x" src="https://user-images.githubusercontent.com/479162/179509650-e1f943a8-463c-4cf4-8fe2-ed296a2adfe6.png">
4. Test email delivery

5. Error in the console
<img width="1270" alt="CleanShot 2565-07-18 at 19 07 22@2x" src="https://user-images.githubusercontent.com/479162/179509405-439b00ae-f6db-4252-a86e-9153f1ca0832.png">
```bash
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.
```
### Expected behavior
Sending a test email successfully.
### Additional context
Github repo for reproduction.
https://github.com/iwoogy/StrapiNodeMailerDev
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