Loading backend/src/email/email.service.ts 0 → 100644 +25 −0 Original line number Diff line number Diff line import { MailerService } from '@nestjs-modules/mailer'; import { Injectable } from '@nestjs/common'; import { MailConstants } from 'src/constants/mail.constants'; import { text } from 'stream/consumers'; @Injectable() export class EmailService { constructor( private readonly mailerService: MailerService, ) { } async sendResetPasswordEmail(email: string, resetCode: string): Promise<void> { const mailOptions = { to: email, subject: 'Reset your password', text: `Your reset code is ${resetCode}`, }; try { await this.mailerService.sendMail(mailOptions); } catch (error) { console.error(error); throw new Error('Error sending email'); } } } Loading
backend/src/email/email.service.ts 0 → 100644 +25 −0 Original line number Diff line number Diff line import { MailerService } from '@nestjs-modules/mailer'; import { Injectable } from '@nestjs/common'; import { MailConstants } from 'src/constants/mail.constants'; import { text } from 'stream/consumers'; @Injectable() export class EmailService { constructor( private readonly mailerService: MailerService, ) { } async sendResetPasswordEmail(email: string, resetCode: string): Promise<void> { const mailOptions = { to: email, subject: 'Reset your password', text: `Your reset code is ${resetCode}`, }; try { await this.mailerService.sendMail(mailOptions); } catch (error) { console.error(error); throw new Error('Error sending email'); } } }