// mail.service.ts import { Injectable } from '@nestjs/common'; import * as nodemailer from 'nodemailer'; @Injectable() export class MailService { private transporter = nodemailer.createTransport({ host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), secure: true, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS } }); async sendOtp(email: string, otp: string) { await this.transporter.sendMail({ from: '"Your App" ', to: email, subject: 'Your OTP Code', text: `Your verification code is ${otp}. It expires in 5 minutes.` }); } }