added mailer

This commit is contained in:
2026-01-27 20:37:50 +01:00
parent a551bf6f6f
commit 62468fe67b
2 changed files with 42 additions and 1 deletions

24
backend/routes/mailer.js Normal file
View File

@@ -0,0 +1,24 @@
import nodemailer from "nodemailer";
export function sendMail(message, title, recipient, host, user, pass, from) {
const transporter = nodemailer.createTransport({
host: host,
port: port,
secure: 465,
auth: {
user: user,
pass: pass,
},
});
async () => {
const info = await transporter.sendMail({
from: from,
to: recipient,
subject: title,
text: message,
});
console.log("Message sent: %s", info.messageId);
};
}