Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const container = new Container();
- container.bind<MailerInterface>(TYPES.Mailer).to(NodeMailer);
- import * as nodemailer from "nodemailer";
- import {TemplateEngineInterface} from "../../Domain/TemplateEngine/TemplateEngineInterface";
- import TYPES from "../../../../config/inversify.types";
- import {inject, injectable, named} from "inversify";
- @injectable()
- export class NodeMailer implements MailerInterface {
- private transporter: any;
- private templateEngine: TemplateEngineInterface;
- constructor(
- @inject(TYPES.TemplateEngine) templateEngine: TemplateEngineInterface,
- host: string,
- port: number,
- secure: boolean,
- username: string,
- password: string
- ) {
- this.templateEngine = templateEngine;
- this.transporter = nodemailer.createTransport({
- host: host,
- port: port,
- secure: secure,
- auth: {
- user: username,
- pass: password
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment