feat: implement email sending functionality with nodemailer; add contact form handling and success/error notifications

This commit is contained in:
2025-02-04 21:12:13 +01:00
parent 2c9f69dcac
commit 05f879d226
7 changed files with 199 additions and 22 deletions

17
app/utils/send-email.tsx Normal file
View File

@@ -0,0 +1,17 @@
import {FormData} from "@/app/components/Contact";
export function sendEmail(data: FormData): Promise<{ success: boolean, message: string }> {
const apiEndpoint = '/api/email';
return fetch(apiEndpoint, {
method: 'POST',
body: JSON.stringify(data),
})
.then((res) => res.json())
.then((response) => {
return {success: true, message: response.message};
})
.catch((err) => {
return {success: false, message: err.message};
});
}