mailer.js 640 Bytes
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
2
const nodemailer = require('nodemailer')

Rosanny Sihombing's avatar
Rosanny Sihombing committed
3
var env = process.env.NODE_ENV || 'testing';
Rosanny Sihombing's avatar
Rosanny Sihombing committed
4
const config = require('./config')[env]
Rosanny Sihombing's avatar
Rosanny Sihombing committed
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

var smtpTransport = nodemailer.createTransport({
    host: config.mailer.host,
    secureConnection: config.mailer.secureConnection,
    port: config.mailer.port,
    auth: {
      user: config.mailer.authUser,
      pass: config.mailer.authPass
    },
    tls: {
        ciphers: config.mailer.tlsCiphers
    } 
});
  
var mailOptions = {
    to: "",
    from: config.mailer.from,
    subject: "",
    text: ""
};

var mailer = {
    transport: smtpTransport,
    options: mailOptions
}

module.exports = mailer