In my case, I have succeded by using your first transport config. I've just included the port to the properties and set it to 587. As mentioned by Google in this link: Send email from a printer, scanner, or app
So here is my transport config:
MailerModule.forRoot({
transport: {
service: 'gmail',
port: 587,
secure: false,
auth: {
user: process.env.MAILDEV_INCOMING_USER,
pass: process.env.MAILDEV_INCOMING_PASS,
},
},
defaults: {
from: '"No Reply" <no-reply@localhost>',
},
preview: false,
template: {
dir: __dirname + '/templates',
adapter: new PugAdapter(),
options: {
strict: true,
},
},
}),
Even though there is an error warning log after the build, like this:
But the module is running successfully: