summaryrefslogtreecommitdiff
path: root/website/src/actions/sendmail.ts
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-12-18 21:08:04 +0000
committerJoe Carstairs <me@joeac.net>2025-12-18 21:08:04 +0000
commit64f20921617835b33458fe911378ca27ee10055a (patch)
treee85540edfd345a0054eb48f5c060b9e82f752540 /website/src/actions/sendmail.ts
parentba4b4ea98033a0a140a17abd55057f08682c8b11 (diff)
website uses smtp
Diffstat (limited to 'website/src/actions/sendmail.ts')
-rw-r--r--website/src/actions/sendmail.ts25
1 files changed, 19 insertions, 6 deletions
diff --git a/website/src/actions/sendmail.ts b/website/src/actions/sendmail.ts
index 3b2d242..bb7d2eb 100644
--- a/website/src/actions/sendmail.ts
+++ b/website/src/actions/sendmail.ts
@@ -1,9 +1,15 @@
import { z } from "astro/zod";
-import { actions, defineAction } from "astro:actions";
+import { defineAction } from "astro:actions";
import nodemailer from "nodemailer";
-import { MAX_DAILY_EMAILS, SENDMAIL_BIN } from "astro:env/server";
-import { and, db, eq, gte, lte, SendmailToken, SentEmails } from "astro:db";
-import { isToken } from "typescript";
+import {
+ MAX_DAILY_EMAILS,
+ SMTP_HOST,
+ SMTP_PASSWORD,
+ SMTP_PORT,
+ SMTP_USE_TLS,
+ SMTP_USER,
+} from "astro:env/server";
+import { and, db, eq, gte, SendmailToken, SentEmails } from "astro:db";
export default defineAction({
input: z.object({
@@ -73,6 +79,13 @@ async function sendmail({
}
const transporter = nodemailer.createTransport({
- sendmail: true,
- path: SENDMAIL_BIN,
+ host: SMTP_HOST,
+ port: SMTP_PORT,
+ secure: false,
+ authMethod: "PLAIN",
+ auth: {
+ type: "login",
+ user: SMTP_USER,
+ pass: SMTP_PASSWORD,
+ },
});