Mingrate mail.services to new logger

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-09-28 12:09:33 +01:00
parent 0576f431dc
commit d9e2445141

View File

@ -1,5 +1,5 @@
const log = require("../utils/logs.utils");
const mail = require("nodemailer"); //>> Probs wrong
const mail = require("nodemailer");
import { logger } from "../utils/logger.utils";
const fromAddr = process.env.OWL_EML_FROM;
const smtpUser = process.env.OWL_EML_USER;
@ -20,15 +20,15 @@ let transporter = mail.createTransport({
/* 'message' is an object containing string values for:
*to, cc, bcc, *subject, *txt, html. * denotes required */
async function send(message) {
log.out("mailServices.send: Message send request received", "info");
logger.debug("mailServices.send: Message send request received");
message.from = fromAddr;
try {
var res = await transporter.sendMail(message);
} catch (err) {
log.out(`mailServices.send: Message send failed: ${err}`, "err");
logger.error(err, "mailServices.send: Message send failed");
return false;
}
log.out(`mailServices.send: SMTP Response: ${res.response}`);
logger.debug(res.response, "mailServices.send: SMTP Response");
return true;
}