- System settings page with tabs: Security, System, Firma
- Configurable attendance rules (break thresholds, rounding) from DB
- Configurable document numbering with template patterns ({YYYY}/{PREFIX}/{NNN})
- Dynamic logo upload (light/dark variants) served from DB instead of static files
- Email settings (SMTP from/name, alert/leave emails) configurable in UI
- Currency and VAT rate lists configurable, used across all modules
- Permissions simplified: offers.settings + settings.roles + settings.security → settings.manage
- Leaflet bundled locally, removed unpkg.com from CSP
- Silent catch blocks fixed with proper logging
- console.log replaced with app.log.info in server.ts
- Schema renamed: company-settings.schema → settings.schema
- App info section: version, Node.js, uptime, memory, DB status, NAS status
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
880 B
TypeScript
38 lines
880 B
TypeScript
import nodemailer from "nodemailer";
|
|
import { config } from "../config/env";
|
|
import { getSystemSettings } from "./system-settings";
|
|
|
|
const transporter = nodemailer.createTransport({
|
|
sendmail: true,
|
|
newline: "unix",
|
|
path: "/usr/sbin/sendmail",
|
|
});
|
|
|
|
export async function sendMail(
|
|
to: string,
|
|
subject: string,
|
|
html: string,
|
|
): Promise<boolean> {
|
|
const settings = await getSystemSettings();
|
|
const from =
|
|
settings.smtp_from ||
|
|
config.email.smtpFrom ||
|
|
config.email.contactFrom ||
|
|
"noreply@example.com";
|
|
const fromName =
|
|
settings.smtp_from_name || config.email.smtpFromName || "System";
|
|
|
|
try {
|
|
await transporter.sendMail({
|
|
from: { name: fromName, address: from },
|
|
to,
|
|
subject,
|
|
html,
|
|
});
|
|
return true;
|
|
} catch (err) {
|
|
console.error(`Mailer error: failed to send to ${to}:`, err);
|
|
return false;
|
|
}
|
|
}
|