45 lines
932 B
TypeScript
45 lines
932 B
TypeScript
import type { Attachment } from "nodemailer/lib/mailer";
|
|
|
|
interface TemplateVariables {
|
|
[key: string]: string | number | boolean;
|
|
}
|
|
|
|
interface SendMailOptions {
|
|
to: string | string[];
|
|
subject: string;
|
|
cc?: string | string[];
|
|
bcc?: string | string[];
|
|
from?: string;
|
|
replyTo?: string;
|
|
template?: string;
|
|
templateVariables?: TemplateVariables;
|
|
html?: string;
|
|
text?: string;
|
|
attachments?: Attachment[];
|
|
priority?: "high" | "normal" | "low";
|
|
headers?: Record<string, string>;
|
|
}
|
|
|
|
type MailerConfig = {
|
|
address: string;
|
|
port: number;
|
|
from: string;
|
|
username: string;
|
|
password: string;
|
|
secure: boolean;
|
|
pool: boolean;
|
|
connectionTimeout: number;
|
|
socketTimeout: number;
|
|
maxConnections: number;
|
|
maxMessages: number;
|
|
replyTo: string;
|
|
};
|
|
|
|
type EmailResult = {
|
|
success: boolean;
|
|
messageId?: string;
|
|
response?: string;
|
|
error?: string;
|
|
};
|
|
|
|
export type { TemplateVariables, SendMailOptions, MailerConfig, EmailResult };
|