const nodemailer = require('nodemailer'); // Create reusable transporter object using Gmail SMTP const transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'veltrix620@gmail.com', pass: 'tdkdumjozzfszxkj' // Gmail app password } }); /** * Generates a 6-digit numeric OTP * @returns {string} 6-digit OTP */ const generateOtp = () => { return Math.floor(100000 + Math.random() * 900000).toString(); }; /** * Sends OTP email to the specified email address * @param {string} email - Recipient email address * @param {string} otp - 6-digit OTP * @returns {Promise} - Nodemailer send promise */ const sendOtpEmail = async (email, otp) => { const mailOptions = { from: 'veltrix620@gmail.com', to: email, subject: 'Your OTP for Seller Panel', html: `

Your OTP for Seller Panel

Your One-Time Password (OTP) is:

${otp}

This OTP is valid for 1 hour. Please do not share this OTP with anyone.

If you didn't request this OTP, please ignore this email.


This is an automated message, please do not reply.

` }; return transporter.sendMail(mailOptions); }; module.exports = { generateOtp, sendOtpEmail };