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:
@@ -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 = () =>
|
||||
|
||||
Reference in New Issue
Block a user