63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
const db = require('../app/db')
|
|
const logger = require('../app/logger');
|
|
const fs = require('fs');
|
|
const nodemailer = require('nodemailer');
|
|
|
|
|
|
var assign_action ={
|
|
|
|
processLinedJobs(value) {
|
|
// const fs = require('fs');
|
|
const file_name ="EMAIL//depend_job_added.html";
|
|
|
|
// fs.readFileSync(`${__dirname}\\FILENAME`);
|
|
|
|
fs.readFile(`${__dirname}/${file_name}`, 'utf8', (err, data) => {
|
|
if (err) {
|
|
console.error(err);
|
|
}
|
|
else
|
|
{
|
|
console.log(data);
|
|
}
|
|
|
|
const transporter = nodemailer.createTransport({
|
|
service: "gmail",
|
|
host: "smtp.gmail.com",
|
|
port: 587,
|
|
secure: false,
|
|
auth: {
|
|
user: "message@chiefsoft.com",
|
|
pass: "may12002!",
|
|
},
|
|
});
|
|
|
|
async function main() {
|
|
// send mail with defined transport object
|
|
const info = await transporter.sendMail({
|
|
from: '"Support ChiefSoft 👻" <message@chiefsoft.com>', // sender address
|
|
to: "ameye@chiefsoft.com", // list of receivers
|
|
bcc: "ses66181@gmail.com", // list of receivers
|
|
subject: "Something good ✔", // Subject line
|
|
text: "To Tester name", // plain text body
|
|
html: data, // html body
|
|
});
|
|
console.log("Message sent: %s", info.messageId);
|
|
// Message sent: <d786aa62-4e0a-070a-47ed-0b0666549519@ethereal.email>
|
|
}
|
|
main().catch(console.error);
|
|
|
|
});
|
|
|
|
console.log(" processLinedJobs ************************ : ", value);
|
|
if (value.depend_uid !== undefined && value.depend_uid.length > 10){
|
|
console.log("We need contact people that did this job: ", value.depend_uid);
|
|
}
|
|
else{
|
|
console.log("Thism is not a referenced job ***** : ");
|
|
}
|
|
},
|
|
|
|
};
|
|
|
|
module.exports = assign_action; |