feat: make SMTP auth optional and add SMTP_SECURE config (#92)

* feat: add SMTP_SECURE option to email config

* feat: allow unauthenticated SMTP servers
This commit is contained in:
Henry
2025-06-19 22:58:13 +01:00
committed by GitHub
parent e7383ec670
commit 500fe8af95
6 changed files with 41 additions and 42 deletions

View File

@@ -16,11 +16,14 @@ const emailTemplates: Record<Templates, React.FC> = {
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
secure: true,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
},
secure: process.env.SMTP_SECURE !== "false",
...(process.env.SMTP_USER &&
process.env.SMTP_PASSWORD && {
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASSWORD,
},
}),
});
export const sendEmail = async (