adba
Version:
Any DataBase to API
33 lines (32 loc) • 1.33 kB
TypeScript
import { Transporter, SendMailOptions } from "nodemailer";
import { Model } from "objection";
interface IEmailProcessModel extends Model, SendMailOptions {
id: number | string;
emailAddress: string[];
order: number;
status: string;
lastAttempt: string;
attempts: number;
active: boolean;
}
export type IEmailConfig = {
EmailProcessModel: typeof Model | null;
SystemModel: typeof Model | null;
colorPrimary: string;
attemptsTotal: number;
maxScheduling: number;
maxPriorScheduling: number;
priorOrder: number;
runningPriorSchedule: boolean;
runningSchedule: boolean;
priorDelay: number;
delay: number;
};
export declare function setEmailProcessModel(EmailProcessModel: typeof Model): void;
export declare function setSystemModel(SystemModel: typeof Model): void;
export declare function colorPrimary(color: string): void;
export declare function setConfig(cfg: Partial<IEmailConfig>): void;
declare const sendEmail: (to: string | string[], template: string, data: object, order?: number) => Promise<boolean>;
export declare const processEmailList: (transporter: Transporter, emailList: IEmailProcessModel[]) => Promise<false | undefined>;
export declare const enqueueEmailList: (transportConf: Partial<Transporter>) => Promise<boolean>;
export default sendEmail;