email integration
* Nest email module with smtp, postmark and console log drivers * react-email package
This commit is contained in:
18
apps/server/src/integrations/mail/drivers/log.driver.ts
Normal file
18
apps/server/src/integrations/mail/drivers/log.driver.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { MailDriver } from './interfaces/mail-driver.interface';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { MailMessage } from '../interfaces/mail.message';
|
||||
import { mailLogName } from '../mail.utils';
|
||||
|
||||
export class LogDriver implements MailDriver {
|
||||
private readonly logger = new Logger(mailLogName(LogDriver.name));
|
||||
|
||||
async sendMail(message: MailMessage): Promise<void> {
|
||||
const mailLog = {
|
||||
to: message.to,
|
||||
subject: message.subject,
|
||||
text: message.text,
|
||||
};
|
||||
|
||||
this.logger.log(`Logged mail: ${JSON.stringify(mailLog)}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user