diff --git a/package.json b/package.json index 7bbeb3d8dac84bcf64c19bce00ea319971fb2c2e..1bab6bbaa289272bb91eeeb20f8168c38e38908c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "service-email", - "version": "1.2.1", + "version": "1.2.2", "description": "description", "author": "", "license": "MIT", diff --git a/src/email/email.service.ts b/src/email/email.service.ts index d4dfa8311cf4d5fc50bb4bea49377cb94b34d136..a703ec280da2ed14232568030154cc4b45f4596d 100644 --- a/src/email/email.service.ts +++ b/src/email/email.service.ts @@ -106,14 +106,14 @@ export class EmailService { const transporter = Nodemailer.createTransport(this.config.smtpConfig); await transporter.verify().catch((error) => { - this.logger.error('SMTP connection failed.', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('SMTP connection failed.', `${error}`, `${EmailService.name} - ${this.send.name}`); throw new InternalServerErrorException({ error, message: 'SMTP connection failed.' }); }); this.logger.log('SMTP Server is ready to receive messages', `${EmailService.name} - ${this.send.name}`); await transporter.sendMail(email).catch((error) => { - this.logger.error('Couldn\'t send email.', error, `${EmailService.name} - ${this.send.name}`); + this.logger.error('Couldn\'t send email.', `${error}`, `${EmailService.name} - ${this.send.name}`); transporter.close(); throw new InternalServerErrorException({ error, message: 'Couldn\'t send email.' }); }); diff --git a/src/health/smtp.healthIndicator.ts b/src/health/smtp.healthIndicator.ts index d7f71993a2e3f55dfada1b6c8ff6c2dc20a9b364..109cb4434acf75c56db0cc70c5c8446e075d78fc 100644 --- a/src/health/smtp.healthIndicator.ts +++ b/src/health/smtp.healthIndicator.ts @@ -22,7 +22,7 @@ export class SmtpHealthIndicator extends HealthIndicator { const transporter = Nodemailer.createTransport(this.configService.config.smtpConfig); await transporter.verify().catch((error) => { - this.logger.error('SMTP connection failed.', error, `${SmtpHealthIndicator.name} - ${this.checkSMTPConnection.name}`); + this.logger.error('SMTP connection failed.', `${error}`, `${SmtpHealthIndicator.name} - ${this.checkSMTPConnection.name}`); transporter.close(); throw new HealthCheckError('SMTP connection failed', error); });