import { Injectable } from '@nestjs/common' import { MailerService } from '@nestjs-modules/mailer' @Injectable() export class EmailService { constructor(private mailerService: MailerService) {} async sendEmailTo(email: string) { return this.mailerService.sendMail({ to: email, // list of receivers subject: 'Testing Nest Mailermodule with template ✔', template: 'index', // The `.pug` or `.hbs` extension is appended automatically. context: { // Data to be sent to template engine. code: 'cf1a3f828287', username: 'john doe', }, }) } }