const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'your-email@gmail.com',
    pass: 'your-app-password'
  }
});

exports.sendInvoiceEmail = async (to, subject, text, attachmentPath) => {
  const mailOptions = {
    from: 'MaanRishfa IT <your-email@gmail.com>',
    to,
    subject,
    text,
    attachments: [{
      filename: attachmentPath.split('/').pop(),
      path: attachmentPath
    }]
  };

  return transporter.sendMail(mailOptions);
};