export type EmailConfig = { host: string; port: number; secure: boolean; from: string; auth: { user: string; pass: string } | null; }; // Liest die SMTP-Konfiguration aus den Umgebungsvariablen. null = E-Mail-Kanal // aus (gleiches Muster wie getWhatsAppConfig): die Outbox-Zeilen bleiben dann // pending, bis SMTP konfiguriert ist. export function getEmailConfig(): EmailConfig | null { const host = process.env.SMTP_HOST; const portRoh = process.env.SMTP_PORT; const from = process.env.SMTP_FROM; if (!host || !portRoh || !from) { return null; } const port = Number(portRoh); if (!Number.isInteger(port) || port <= 0) { return null; } const user = process.env.SMTP_USER; const pass = process.env.SMTP_PASSWORD; return { host, port, secure: process.env.SMTP_SECURE?.trim().toLowerCase() === "true", from, auth: user && pass ? { user, pass } : null, }; }