Files
listify/listify-api/src/mail/mail.service.ts
Bastian Wagner 537c7cbbee Initial
2026-06-09 09:45:33 +02:00

27 lines
721 B
TypeScript

import { Injectable, Logger } from '@nestjs/common';
import { SentEmail } from './mail.types';
@Injectable()
export class MailService {
private readonly logger = new Logger(MailService.name);
private readonly sentEmails: SentEmail[] = [];
sendVerificationEmail(to: string, verificationUrl: string): void {
const email: SentEmail = {
to,
subject: 'Verify your Listify account',
text: `Please verify your account by opening this link: ${verificationUrl}`,
verificationUrl,
};
this.sentEmails.push(email);
this.logger.log(
`Verification email sent to ${to}: ${email.verificationUrl}`,
);
}
getSentEmails(): SentEmail[] {
return [...this.sentEmails];
}
}