mailer.ts 805 Bytes
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const nodemailer = require('nodemailer')
const nodemailerNTLMAuth = require('nodemailer-ntlm-auth')

var env = process.env.NODE_ENV || 'testing'
const config = require('./config')[env]

var smtpTransporter = nodemailer.createTransport({
  host: config.mailer.host,
  secure: config.mailer.secureConnection,
  port: config.mailer.port,
  requireTLS: config.mailer.TLS,
  auth: {
    type: 'custom',
    method: 'NTLM',
    user: config.mailer.authUser,
    pass: config.mailer.authPass,
    options: {
      domain: 'ad'
    }
  },
  customAuth:{
    NTLM: nodemailerNTLMAuth
  }
});

var mailOptions:any = {
    to: "",
    cc: "",
    from: config.mailer.from,
    subject: "",
    text: "",
    html: ""
}

var mailer:any = {
    transporter: smtpTransporter,
    options: mailOptions
}

export = mailer