On this page
Tracks

Mail sending Nodejs Script

Last reviewed 2 Sept 2026

const fs = require('fs');
const xlsx = require('xlsx');
const nodemailer = require('nodemailer');
const { exit } = require('process');

// download the above packages

// Load your Excel file

const workbook = xlsx.readFile(’./list.xlsx’); // Path for the sheet in your local folder

const sheetName = ‘Bytedance’; // Change to the name of your sheet

const worksheet = workbook.Sheets[sheetName];
const data = xlsx.utils.sheet_to_json(worksheet);

// Email configuration

const newTransporter = ()=>{
return nodemailer.createTransport({
pool: true,
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: "vaibhavmishra.dev@gmail.com",
pass: "pass pass pass pass"

},

});
}
const transporter = newTransporter();
const sendEmail = async (row) => {
const { Name, Company, Email, Role, Link } = row; // Adjust column names accordingly
const nameParts = Name.split(' ');
const name = nameParts[0];
const mailOptions = {
from: 'Vaibhav Mishra <vaibhavmishra.dev@gmail.com>',
to: Email,
subject: `Request for an Interview Opportunity - ${Role} at ${Company}`,
html: `

Greetings ${name},

I'm Vaibhav Mishra, a Software Developer at Groww. I got to know through your linkedin post that ${Company} is looking for a ${Role}, therefore, I have mailed you to tell you about myself. I have:

  • More than 3 Years of hands-on experience in Frontend Domain
  • 2.3 Years Experience as a Frontend Developer at Groww
  • Worked extensively in JavaScript, Typescript, React & Next.js
  • Familiar with REST, GraphQL, monorepo codebases, Jest & React Testing library
  • Worked in the Indian Equity and F&O team having more than 25M monthly active users.
  • 9 months Experience as SDE Intern in Groww
  • 3 months Experience as Full Stack Developer Intern in Prographer
  • Bachelor's in Computer Science from IIIT Gwalior, 2022 Grad
  • Expert at Codeforces(Rating: 1645).

Currently, I am serving a notice period and can join within 15 days of receiving an offer. A little help from your side can significantly help my career.

PS: I have attached my Resume & Linkedin Profile ${Link !== undefined ? \`& ${Role} Opening\`: '' } for you to take a look at. If you find me suitable, please help me with an Interview Opportunity at ${Company}.

Thanking You

Regards,

Vaibhav Mishra

Contact No: +91 9876543210

\`
};
try {
await transporter.sendMail(mailOptions);
console.log('Email sent to', Email);

} catch (error) {

console.error('Error sending email:', Email, error);
}
};
const sendEmailsSynchronously = async () => {
for (const row of data) {
await sendEmail(row);

await new Promise((resolve) => setTimeout(resolve, Math.random()*90000)); // Pause for 1 minute (adjust the duration as needed)

}
console.log("Done Sending mails")

exit()

};

// Call the function to send emails

sendEmailsSynchronously();