'use strict'; const nodemailer = require('nodemailer'), env = require('./env.js'); let transporter = nodemailer.createTransport({ host: 'keithirwin.us', port: 587, secure: false, requireTLS: true, auth: { user: 'NoReply@tracman.org', pass: 'Ei0UwfrZuE' }, // logger: true, // debug: true }); /* Confirm login */ // transporter.verify(function(err, success) { // if (err){ console.error(`SMTP Error: ${err}`); } // console.log(`SMTP ${!success?'not ':''}ready...`); // }); /* Send test email */ // transporter.sendMail({ // to: `"Keith Irwin" `, // from: '"Tracman" ', // subject: 'Test email', // text: "Looks like everything's working", // html: "" // }).then(function(){ // console.log("Email should have sent..."); // }).catch(function(err){ // console.error(err); // }); module.exports = { send: transporter.sendMail.bind(transporter), text: function(text) { return `Tracman\n\n${text}\n\nDo not reply to this email\nFor information about why you received this email, see the privacy policy at ${env.url}/privacyy#email`; }, html: function(text) { return `

+Tracman

${text}

Do not reply to this email. For information about why you recieved this email, see our privacy policy.

`; }, from: `"Tracman" `, to: function(user) { return `"${user.name}" <${user.email}>`; } };