Compare commits

...

2 Commits

Author SHA1 Message Date
Fred Boniface 062efd940f Beef out mail.services 2023-04-01 15:09:29 +01:00
Fred Boniface 81d3838588 Tidy app.js code 2023-04-01 14:44:06 +01:00
2 changed files with 32 additions and 2 deletions

1
app.js
View File

@ -47,7 +47,6 @@ app.use((err, req, res, next) => {
// Express Submodules:
app.use(express.json()); //JSON Parsing for POST Requests
//STATIC CONTENT NO LONGER SERVED FROM NODE
app.use(compression()) // Compress API Data if supported by client
// Express Routes

View File

@ -2,9 +2,34 @@ const log = require('../utils/log.utils')
const fs = require('fs')
const mail = require('node-mailer'); //>> Probs wrong
const fromAdrr = 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
async function sendTest() {
const options = {
host: smtpHost,
port: smtpPort,
secure: true,
auth: {
user: smtpUser,
pass: smtpPass
}
}
let transporter = nodemailer.createTransport(options)
async function sendTest(to, subject, plaintext, html) {
log.out(`mailServices.sendTest: Sending test message to: ${to}, subject: ${subject}`, "info")
// Send test mail message
let res = await transporter.sendMail({
from: fromAdrr,
to: to,
subject: subject,
text: plaintext,
html: html
});
return;
}
@ -14,4 +39,10 @@ async function sendRegister() {
async function sendAlert() {
return;
}
module.exports = {
sendTest,
sendRegister,
sendAlert
}