d-branch-2 (#18)

*  refactor: streamline sitemap generation and contact form logic

*  refactor: update sendEmail function to handle JSON data
This commit is contained in:
Denshooter
2025-02-13 12:42:06 +01:00
committed by GitHub
parent 996b1b74f9
commit 2c4842cf1f
4 changed files with 140 additions and 133 deletions

View File

@@ -7,7 +7,12 @@ import dotenv from "dotenv";
dotenv.config();
export async function POST(request: NextRequest) {
const { email, name, message } = await request.json();
const body = (await request.json()) as {
email: string;
name: string;
message: string;
};
const { email, name, message } = body;
const user = process.env.MY_EMAIL ?? "";
const pass = process.env.MY_PASSWORD ?? "";
@@ -38,7 +43,7 @@ export async function POST(request: NextRequest) {
from: user,
to: user, // Ensure this is the correct email address
subject: `Message from ${name} (${email})`,
text: message + `\n\nSent from ${email}`,
text: message + "\n\n" + email,
};
const sendMailPromise = () =>