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