newStaffLDB-API #48
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user