summaryrefslogtreecommitdiff
path: root/website/src
diff options
context:
space:
mode:
Diffstat (limited to 'website/src')
-rw-r--r--website/src/actions/otp/send-otp.ts18
-rw-r--r--website/src/actions/sendmail.ts25
2 files changed, 34 insertions, 9 deletions
diff --git a/website/src/actions/otp/send-otp.ts b/website/src/actions/otp/send-otp.ts
index b349feb..23f8dc0 100644
--- a/website/src/actions/otp/send-otp.ts
+++ b/website/src/actions/otp/send-otp.ts
@@ -1,9 +1,14 @@
import crypto from "node:crypto";
-import { SENDMAIL_BIN } from "astro:env/server";
import nodemailer from "nodemailer";
import { z } from "astro/zod";
import { defineAction } from "astro:actions";
import { db, Otp } from "astro:db";
+import {
+ SMTP_HOST,
+ SMTP_PASSWORD,
+ SMTP_PORT,
+ SMTP_USER,
+} from "astro:env/server";
export default defineAction({
input: z.object({
@@ -46,6 +51,13 @@ to do anything.`,
}
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,
+ },
});
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,
+ },
});