Skip to content

Instantly share code, notes, and snippets.

@fachryansyah
Created November 7, 2021 13:26
Show Gist options
  • Save fachryansyah/90b78f81ece9e7d4ea238bf5f0066e36 to your computer and use it in GitHub Desktop.
Save fachryansyah/90b78f81ece9e7d4ea238bf5f0066e36 to your computer and use it in GitHub Desktop.
mail.js
const { parentPort, workerData } = require('worker_threads');
const { sendMail } = require("../module/mailer");
// Perform send mail
parentPort.once("message", (message) => {
message.forEach(async item => {
await sendMail(item.transporterOptions, item.mailOptions, item.num);
});
});
// Send the hashedArray to the parent thread
// parentPort.postMessage("Oke sended!");
// process.exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment