const nodemailer = require('nodemailer')

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

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