import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  service: 'Gmail',
  auth: {
    user: process.env.EMAIL_USER, 
    pass: process.env.EMAIL_PASS, 
  },
});
 
const sendActivationEmail = async (email, activationCode) => {
  const mailOptions = {
    from: process.env.EMAIL_USER,
    to: email,
    subject: 'Account Activation',
    text: `Activate your account by clicking the following link: ${process.env.BASE_URL}/activate/${activationCode}`,
  };
  await transporter.sendMail(mailOptions);
};

export { sendActivationEmail };
