You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
585 B

import nodemailer from "nodemailer";
function getTransporter() {
return nodemailer.createTransport({
host: "smtp.gmail.com",
port: 587,
secure: false,
auth: {
user: process.env.GMAIL_USER,
pass: "yuuu kvoi ytrf blla",
},
});
};
export function sendEmail(to, subject, text, html = null) {
const transporter = getTransporter();
const mailOptions = {
from: process.env.GMAIL_USER,
to,
subject,
text,
};
// Add HTML if provided
if (html) {
mailOptions.html = html;
}
return transporter.sendMail(mailOptions);
}