我使用的是NestJs Mailer Module,最新的稳定版本。您可以找到文档here。
我已经搜索了这个错误的解决方案,但我什么也没找到:
Error: self signed certificate in certificate chainapp.module.ts:
@Module({
imports: [
MailerModule.forRoot({
transport: 'smtps://user@domain.com:pass@smtp.domain.com',
defaults: {
from:'"nest-modules" <modules@nestjs.com>',
},
template: {
dir: __dirname + '/templates',
adapter: new HandlebarsAdapter(),
options: {
strict: true,
},
},
}),
],
})
export class AppModule {}发送电子邮件:
this.mailerService.sendMail({
to: 'example@domain.com',
subject: 'subject'
text: 'blahblahblah'
html: 'blahblahblah'
}).then(() => {
this.logger.log('Error email sent!', 'HttpExceptionFilter');
}).catch(err => {
this.logger.error('Error while sending error email.', err, 'HttpExceptionFilter');
});发布于 2021-01-15 01:32:29
作为解决方案,您可以在传输选项中使用tls: { rejectUnauthorized: false }。
https://stackoverflow.com/questions/62998727
复制相似问题