import { Resend } from 'resend';
export const sendEmail = async (
firstName: string,
lastName: string,
email: string,
phone: string,
message: string,
date: string,
time: string,
user_agent: string,
env: any
) => {
const resend = new Resend(env.RESEND_API_KEY);
const { data, error } = await resend.emails.send({
from: env.RESEND_FROM_EMAIL,
to: "gigwork404@gmail.com",
subject: `New Contact Form Submission`,
html: `
New Contact Form Submission
|
Gigwork
|
New Contact Form Submission
You have received a new message from your website's contact form. Here are the details:
| Name: |
${firstName} ${lastName} |
| Email: |
${email}
|
| Phone: |
${phone}
|
| Message: |
${message} |
| Date & Time: |
${date} at ${time} |
|
This is an automated notification. Please do not reply directly to this email.
|
|
© 2025 Gigwork. All rights reserved.
You're receiving this email because you're the administrator of gigwork.co.in
|
|
`
});
if (error) {
console.error('Error sending email:', error);
return null;
}
return data;
}