feat : update
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import "server-only";
|
||||
|
||||
const FROM = "Buzz Guide <[email protected]>";
|
||||
|
||||
export async function sendAuthEmail(to: string, subject: string, text: string): Promise<void> {
|
||||
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}).`);
|
||||
}
|
||||
Reference in New Issue
Block a user