Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1f5166ef2 | |||
| f4fe2d25fb | |||
| f0e293d708 | |||
| 68482004ac | |||
| 20171cb342 | |||
| e7014cd9b1 | |||
| dcdc958df3 | |||
| 1f5f265de2 | |||
| b6655bfd62 |
58
src/app/api/contact/route.ts
Normal file
58
src/app/api/contact/route.ts
Normal 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 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -251,12 +251,22 @@ export default function LandingPage() {
|
|||||||
<ContactCenter
|
<ContactCenter
|
||||||
tag="Ready to Win?"
|
tag="Ready to Win?"
|
||||||
title="Your Next Customer Is Searching Online Right Now."
|
title="Your Next Customer Is Searching Online Right Now."
|
||||||
description="Don't let them find your competitor. Launch your luxury website and start converting customers today. Limited availability for new projects. Contact us at Luxorasites.build@gmail.com to get started."
|
description="Don't let them find your competitor. Launch your luxury website and start converting customers today. Limited availability for new projects. Email us at Luxorasites.build@gmail.com to get started."
|
||||||
background={{ variant: "rotated-rays-animated" }}
|
background={{ variant: "rotated-rays-animated" }}
|
||||||
useInvertedBackground={true}
|
useInvertedBackground={true}
|
||||||
inputPlaceholder="your@email.com"
|
inputPlaceholder="your@email.com"
|
||||||
buttonText="Start My Website"
|
buttonText="Start My Website"
|
||||||
termsText="We'll contact you within 24 hours to discuss your project. No spam, just premium web solutions."
|
termsText="We'll contact you within 24 hours to discuss your project. No spam, just premium web solutions."
|
||||||
|
onSubmit={(email: string) => {
|
||||||
|
// Send email to Luxorasites.build@gmail.com
|
||||||
|
fetch('/api/contact', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ email, recipientEmail: 'Luxorasites.build@gmail.com' }),
|
||||||
|
}).catch(err => console.error('Error submitting contact form:', err));
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user