Preview:
const kue = require('kue');
const queue = kue.createQueue();

const addEmailJob = (email, subject, html) => {
  const job = queue.create('email', {
    email,
    subject,
    html
  })
    .save((error) => {
      if (error) {
        console.error(error);
      } else {
        console.log(`Email job added to queue: ${email}`);
}
});
};

// Add 50,000 email jobs to the queue
const emailList = [
{ email: 'recipient1@example.com', subject: 'Test email 1', html: '<p>This is a test email 1</p>' },
{ email: 'recipient2@example.com', subject: 'Test email 2', html: '<p>This is a test email 2</p>' },
// ...
{ email: 'recipient50000@example.com', subject: 'Test email 50000', html: '<p>This is a test email 50000</p>' }
];

emailList.forEach((emailData) => {
addEmailJob(emailData.email, emailData.subject, emailData.html);
});
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter