mirror of
https://github.com/docmost/docmost.git
synced 2026-05-19 07:54:05 +08:00
email integration
* Nest email module with smtp, postmark and console log drivers * react-email package
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { MAIL_DRIVER_TOKEN } from './mail.constants';
|
||||
import { MailDriver } from './drivers/interfaces/mail-driver.interface';
|
||||
import { MailMessage } from './interfaces/mail.message';
|
||||
import { EnvironmentService } from '../environment/environment.service';
|
||||
|
||||
@Injectable()
|
||||
export class MailService {
|
||||
constructor(
|
||||
@Inject(MAIL_DRIVER_TOKEN) private mailDriver: MailDriver,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
) {}
|
||||
|
||||
async sendMail(message: Omit<MailMessage, 'from'>): Promise<void> {
|
||||
const sender = `${this.environmentService.getMailFromName()} <${this.environmentService.getMailFromAddress()}> `;
|
||||
await this.mailDriver.sendMail({ from: sender, ...message });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user