4 Commits

Author SHA1 Message Date
e97c997931 Merge version_7 into main
Merge version_7 into main
2026-03-06 05:52:32 +00:00
a1f5166ef2 Update src/app/page.tsx 2026-03-06 05:52:27 +00:00
f4fe2d25fb Add src/app/api/contact/route.ts 2026-03-06 05:52:26 +00:00
f0e293d708 Merge version_6 into main
Merge version_6 into main
2026-03-06 05:36:01 +00:00
2 changed files with 59 additions and 1 deletions

View File

@@ -0,0 +1,58 @@
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { email, recipientEmail = 'Luxorasites.build@gmail.com' } = body;
if (!email) {
return NextResponse.json(
{ error: 'Email is required' },
{ status: 400 }
);
}
// Send email using a service like Resend, SendGrid, or Nodemailer
// For now, we'll use Resend (popular choice for Next.js)
// You'll need to install: npm install resend
// And set RESEND_API_KEY environment variable
// Example using Resend:
const response = await fetch('https://api.resend.com/emails', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.RESEND_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: 'noreply@luxorasites.com',
to: recipientEmail,
subject: 'New Website Inquiry',
html: `
<h2>New Contact Form Submission</h2>
<p><strong>Email:</strong> ${email}</p>
<p>A new visitor has submitted their email through the contact form on your website.</p>
`,
}),
});
if (!response.ok) {
console.error('Failed to send email:', await response.text());
return NextResponse.json(
{ error: 'Failed to send email' },
{ status: 500 }
);
}
return NextResponse.json(
{ success: true, message: 'Email sent successfully' },
{ status: 200 }
);
} catch (error) {
console.error('Contact form error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}

View File

@@ -264,7 +264,7 @@ export default function LandingPage() {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email }),
body: JSON.stringify({ email, recipientEmail: 'Luxorasites.build@gmail.com' }),
}).catch(err => console.error('Error submitting contact form:', err));
}}
/>