action.ts
1"use server";23import { Resend } from "resend";45export async function sendEmail(data: {6name: string, email: string, message: string7}) {8try {9const { name, email, message } = data;10// Send email using Resend11await resend.emails.send({12from: "onboarding@resend.dev",13to: "recipient@example.com",14subject: `New message from ${name}`,15text: `Name: ${name}\nEmail: ${email}\nMessage: ${message}`16});17return { success: true };18} catch (error) {19// Handle errors20return { success: false, error: "Failed to send email" };21}22}