ts-mailer
Version:
This lib provide a class and function as singleton instance to compile a hbs template adding data and send it as an email using aws-ses. ## Send email using hbs template and aws-ses
43 lines • 1.59 kB
TypeScript
import { SendEmailCommandOutput } from '@aws-sdk/client-sesv2';
import { IBaseVariables, IMailer, ITemplatesCompiler } from './mailer.interface';
import { IAwsMailerProvider } from './mailer.provider';
export declare class Mailer implements IMailer {
private readonly templateCompiler;
private readonly client;
constructor(awsMailer: IAwsMailerProvider, templateCompiler: ITemplatesCompiler);
/**
* @description singleton client instance to send emails by aws ses
* @param params as Object
* @example
* {
* fromEmail: 'my-email@domain.com',
* subject: 'some subject',
* templatePath: resolve(__dirname, 'templates', 'my-template.hbs'),
* toEmails: [ 'destination@domain.com' ],
* data: { userName: 'John Doe' },
* bcc: [ 'financial@domain.com' ],
* cc: [ 'my-email@domain.com' ]
* }
* @returns `{ $metadata, MessageId }`
* @example
* `
* "$metadata": {
* "httpStatusCode": 200,
* "requestId": "e6c808b4-4246-43a5-908d-bfb2d42b5de0",
* "attempts": 1,
* "totalRetryDelay": 0
* }
* "MessageId": "0100017fa29f0e77-d32250df-e245-4bbc-b7f3-9d56a0a214ae-000000"
* `
*
* @augments data the values refer to what is being applied in the template
* @example
* // on template you can access data as example
* `
* <h1>{{ userName }}</h1>
* `
*/
sendEmail<T>(params: IBaseVariables<T>): Promise<SendEmailCommandOutput>;
}
export default Mailer;
//# sourceMappingURL=mail-sender.d.ts.map