@szegedsw/lib-node
Version:
A little framework published by Szeged Software Zrt. in order to enhance api endpoint security and create reuseable code. Email module, Logging system, and much more. Further improvements are expected.
47 lines • 2.29 kB
TypeScript
import Mail from "nodemailer/lib/mailer";
import SMTPPool from "nodemailer/lib/smtp-pool";
export interface IEmailEvents {
STARTUP: any;
SHUTDOWN: any;
ERROR: any;
UPLOAD: any;
}
export declare type SMPTOptions = SMTPPool.Options;
export declare enum MailPriority {
high = "high",
normal = "normal",
low = "low"
}
export declare class EmailService {
private static readonly mailers;
/**
* @description Use this function if you are using a supported service of nodemailer.
* @param service one of listed here: https://nodemailer.com/smtp/well-known/
* @param user email account username
* @param password email account password
* @param defaultRecipients default list of recipients
* @param allowEmail flag for allowing email sending by default
*/
static configEmailService(service?: string, user?: string, password?: string, allowEmail?: boolean): void;
/**
* @description Use this function if you are using an individual mail server not listed in supported services of nodemailer.
* @param allowEmail flag for allowing email sending by default
*/
static configEmailTransport(options?: SMTPPool.Options, allowEmail?: boolean): void;
static sendDefaultMail(to: string[], subject: string, text: string, priority: MailPriority, isHtml?: boolean, attachments?: Mail.Attachment[]): Promise<boolean>;
static sendEventEmail(event: keyof IEmailEvents, text?: string, attachments?: Mail.Attachment[]): Promise<void>;
/**
* @param from email user, from where email will be sent
* @param recipients addresses of recipients
* @param subject email subject
* @param html formatted including parameters
* @param parameters object of parameters included in mail html, for replacement of values
*/
static sendNiceMail(from: string, recipients: string[], subject: string, html: string, parameters: {
[key: string]: string;
}): Promise<boolean | undefined>;
static sendMail(from: string, to: string[], subject: string, text: string, priority: MailPriority, isHtml?: boolean, attachments?: Mail.Attachment[]): Promise<boolean>;
static closeTransports(): void;
private static createTransport;
}
//# sourceMappingURL=email.service.d.ts.map