const {noticeMailTemplate} = require('../helpers/generalMail');
const login_link = "https://kwarapoly.corass.ng/staff-login";
const nodemailer = require("nodemailer")
module.exports = async (email, name) => {
let transporter = nodemailer.createTransport({
      host: "mail.corass.ng",
      port: 465,
      secure: true,
      auth: {
        type: "login",
        user: "support@corass.ng",
        pass: "YI9Ni52%3BBJ",
      },
      tls: {
        // do not fail on invalid certs
        rejectUnauthorized: false
      },
      ignoreTLS: false
    });
  
    let info = await transporter.sendMail({
      from: "CORASS support@corass.ng",
      to: `${email}`,
      subject: "CORASS: BEGINNING OF 2022/2023 ACADEMIC SESSION ",
      html: `${noticeMailTemplate(name,login_link)}`,
    });
  
    transporter.sendMail(info, (err) => {
      if (err) {
        console.log("error");
      } else {
  
        console.log(info);
      }
    });
};