Guest User

Untitled

a guest
Dec 7th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. const container = new Container();
  2. container.bind<MailerInterface>(TYPES.Mailer).to(NodeMailer);
  3.  
  4. import * as nodemailer from "nodemailer";
  5. import {TemplateEngineInterface} from "../../Domain/TemplateEngine/TemplateEngineInterface";
  6. import TYPES from "../../../../config/inversify.types";
  7. import {inject, injectable, named} from "inversify";
  8.  
  9. @injectable()
  10. export class NodeMailer implements MailerInterface {
  11.  
  12. private transporter: any;
  13. private templateEngine: TemplateEngineInterface;
  14.  
  15. constructor(
  16. @inject(TYPES.TemplateEngine) templateEngine: TemplateEngineInterface,
  17. host: string,
  18. port: number,
  19. secure: boolean,
  20. username: string,
  21. password: string
  22. ) {
  23.  
  24. this.templateEngine = templateEngine;
  25.  
  26. this.transporter = nodemailer.createTransport({
  27. host: host,
  28. port: port,
  29. secure: secure,
  30. auth: {
  31. user: username,
  32. pass: password
  33. }
  34. });
  35.  
  36. }
  37.  
  38. }
Add Comment
Please, Sign In to add comment