email integration

* Nest email module with smtp, postmark and console log drivers
* react-email package
This commit is contained in:
Philipinho
2024-05-02 03:12:40 +01:00
parent 48be0c21ae
commit 4c573b9bc2
26 changed files with 2685 additions and 446 deletions

View File

@ -0,0 +1 @@
export * from './mail.interface';

View File

@ -0,0 +1,30 @@
import SMTPTransport from 'nodemailer/lib/smtp-transport';
export enum MailOption {
SMTP = 'smtp',
Postmark = 'postmark',
Log = 'log',
}
export type MailConfig =
| { driver: MailOption.SMTP; config: SMTPConfig }
| { driver: MailOption.Postmark; config: PostmarkConfig }
| { driver: MailOption.Log; config: LogConfig };
export interface SMTPConfig extends SMTPTransport.Options {}
export interface PostmarkConfig {
postmarkToken: string;
}
export interface LogConfig {}
export interface MailOptions {
mail: MailConfig;
}
export interface MailOptionsFactory {
createMailOptions(): Promise<MailConfig> | MailConfig;
}
export interface MailModuleOptions {
imports?: any[];
}

View File

@ -0,0 +1,7 @@
export interface MailMessage {
from: string;
to: string;
subject: string;
text?: string;
html?: string;
}