import { Resend } from 'resend'; const resend = new Resend(process.env.RESEND_API_KEY); const FROM = process.env.RESEND_FROM_EMAIL ?? 'noreply@pawlink.pt'; export interface SendEmailOptions { to: string; subject: string; html: string; } export async function sendEmail({ to, subject, html }: SendEmailOptions) { const { data, error } = await resend.emails.send({ from: `PawLink <${FROM}>`, to, subject, html, }); if (error) { console.error('[email] Falha ao enviar:', error); throw new Error(`Falha ao enviar email: ${error.message}`); } return data; } export function buildReservationConfirmationHtml(opts: { userName: string; animalName: string; shelterName: string; date: string; }): string { return `