const log = require('../utils/log.utils') const mail = require('nodemailer'); //>> Probs wrong const fromAddr = process.env.OWL_EML_FROM const smtpUser = process.env.OWL_EML_USER const smtpPass = process.env.OWL_EML_PASS const smtpHost = process.env.OWL_EML_HOST const smtpPort = process.env.OWL_EML_PORT let transporter = mail.createTransport({ host: smtpHost, port: smtpPort, secure: false, // Must be false for STARTTLS on port 587 auth: { user: smtpUser, pass: smtpPass } }) async function send(message){ // message is an object containing strings for: *to, cc, bcc, *subject, *txt, html (* denotes required) log.out(`mailServices.send: Message send request received`, "info") message.from = fromAddr try { var res = await transporter.sendMail(message) } catch(err) { log.out(`mailServices.send: Message send failed`, "err") return false; } log.out(`mailServices.send: SMTP Response: ${res.response}`) return true; } module.exports = { send }