I'm trying to send email with the mailer and nestjs. The error it gives:
ErrorError: Invalid login: 535-5.7.8 Username and Password not accepted. learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials w5sm528203qko.34 - gsmtp
Installed the module following this link
My app.module.ts I add:
MailerModule.forRoot({
transport: 'smtps://rafaelribeirosouza86@gmail.com:password@smtp.gmail.com',
defaults: {
from: '"nest-modules" <rafaelribeirosouza86@gmail.com>',
}
})
My service:
await this.mailerService
.sendMail({
to: createCatDto.email, // list of receivers
from: 'rafaelribeirosouza86@gmail.com', // sender address
subject: 'Novo password', // Subject line
text: 'Sua nova senha é:'+createCatDto.senhaNormal // plaintext body
//html: '<b>welcome</b>', // HTML body content
})
.then(() => {})
.catch((error) => {console.log("Error"+error)});
Remembering that nestjs is an api for android and in the api I'm trying to send email