Initial Bizone Next.js website

This commit is contained in:
2026-05-12 14:06:52 +07:00
commit 6206154aa1
53 changed files with 11209 additions and 0 deletions

28
src/lib/mailer.ts Normal file
View File

@ -0,0 +1,28 @@
import nodemailer from "nodemailer";
function getRequiredEnv(name: string) {
const value = process.env[name];
if (!value) {
throw new Error(`Missing required environment variable: ${name}`);
}
return value;
}
export function createMailerTransport() {
return nodemailer.createTransport({
host: getRequiredEnv("SMTP_HOST"),
port: Number(process.env.SMTP_PORT || 465),
secure: true,
auth: {
user: getRequiredEnv("SMTP_USER"),
pass: getRequiredEnv("SMTP_PASS"),
},
});
}
export function getMailerConfig() {
return {
from: process.env.CONTACT_FROM_EMAIL || getRequiredEnv("SMTP_USER"),
to: process.env.CONTACT_TO_EMAIL || "info@bizone.id",
};
}