implement blog subscription feature with modal and email handling

This commit is contained in:
2026-06-02 19:46:47 +02:00
parent 77f3c4ddbd
commit 3f985af13b
7 changed files with 108 additions and 85 deletions
+16
View File
@@ -25,3 +25,19 @@ export async function sendMail({ subject, html, from }: SendMailOptions) {
return data;
}
export async function addContact(email: string) {
const audienceId = process.env.RESEND_AUDIENCE_ID;
if (!audienceId) throw new Error('RESEND_AUDIENCE_ID is not set');
const { data, error } = await resend.contacts.create({
email,
audienceId,
unsubscribed: false,
});
if (error) throw error;
return data;
}