Upload via GUI (16 Dateien)

This commit is contained in:
2026-09-14 18:57:05 +00:00
parent 6733901d99
commit 98d23de73f
16 changed files with 1930 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
// mailer.js — sends mail through the practice's own SMTP account (their normal
// mailbox + an app password, entered once in Einstellungen). No third-party email
// service involved; credentials are stored in the shared data folder's database,
// same trust model as the folder path itself.
"use strict";
const nodemailer = require("nodemailer");
function buildTransport(smtp) {
return nodemailer.createTransport({
host: smtp.host,
port: Number(smtp.port) || 587,
secure: !!smtp.secure,
auth: smtp.user ? { user: smtp.user, pass: smtp.pass } : undefined,
});
}
async function verifySmtp(smtp) {
const transporter = buildTransport(smtp);
await transporter.verify();
}
async function sendMail(smtp, { to, subject, text, attachments }) {
const transporter = buildTransport(smtp);
const fromAddress = smtp.fromEmail || smtp.user;
await transporter.sendMail({
from: smtp.fromName ? `"${smtp.fromName}" <${fromAddress}>` : fromAddress,
to,
subject,
text,
attachments,
});
}
module.exports = { verifySmtp, sendMail };