- Next.js 16 App Router site with the ANOUMA design system - Payload CMS (PostgreSQL) for offers, events, posts and page content - WebRTC video-call system with custom signaling server - SMTP email reminders and booking-request notifications - Customer accounts, calendar-based availability, and booking workflow
26 lines
836 B
TypeScript
26 lines
836 B
TypeScript
import nodemailer from "nodemailer";
|
|
|
|
let cached: nodemailer.Transporter | null = null;
|
|
|
|
/** SMTP transporter for the existing ANOUMA mail system — no external newsletter service. */
|
|
export function getMailTransport(): nodemailer.Transporter {
|
|
if (cached) return cached;
|
|
|
|
const { SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD } = process.env;
|
|
if (!SMTP_HOST || !SMTP_PORT || !SMTP_USER || !SMTP_PASSWORD) {
|
|
throw new Error("SMTP_HOST, SMTP_PORT, SMTP_USER and SMTP_PASSWORD must be set to send email.");
|
|
}
|
|
|
|
cached = nodemailer.createTransport({
|
|
host: SMTP_HOST,
|
|
port: Number(SMTP_PORT),
|
|
secure: Number(SMTP_PORT) === 465,
|
|
auth: { user: SMTP_USER, pass: SMTP_PASSWORD },
|
|
});
|
|
return cached;
|
|
}
|
|
|
|
export function getMailFrom(): string {
|
|
return process.env.SMTP_FROM || "ANOUMA <support@anouma.org>";
|
|
}
|