feat: wire welcome email for new member creation

This commit is contained in:
Jennie Robinson Faber 2026-04-04 12:40:15 +01:00
parent 8b7f124f15
commit a32e4de2ac
2 changed files with 43 additions and 2 deletions

View file

@ -255,3 +255,38 @@ ${eventList}`,
return { success: false, error };
}
}
/**
* Send welcome email to new member
*/
export async function sendWelcomeEmail(member) {
const baseUrl = process.env.BASE_URL || "https://ghostguild.org";
try {
const { data, error } = await resend.emails.send({
from: "Ghost Guild <ghostguild@babyghosts.org>",
to: [member.email],
subject: "Welcome to Ghost Guild",
text: `Hi ${member.name},
Welcome to Ghost Guild! You're now part of the ${member.circle} circle.
Sign in to your dashboard:
${baseUrl}/member/dashboard
If you have questions, reach out on Slack or reply to this email.
Ghost Guild`,
});
if (error) {
console.error("Failed to send welcome email:", error);
return { success: false, error };
}
return { success: true, data };
} catch (error) {
console.error("Error sending welcome email:", error);
return { success: false, error };
}
}