import "server-only"; const FROM = "Buzz Guide "; export async function sendAuthEmail(to: string, subject: string, text: string): Promise { const apiKey = process.env.RESEND_API_KEY; if (!apiKey) throw new Error("RESEND_API_KEY is required for authentication email."); const response = await fetch("https://api.resend.com/emails", { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ from: FROM, to: [to], subject, text }), }); if (!response.ok) throw new Error(`Authentication email delivery failed (${response.status}).`); }