Remove EMAIL_RECIPIENTS environment variable and update email notification logic

This commit is contained in:
Ryderjj89
2025-05-16 18:46:07 -04:00
parent cedd7b325f
commit 55b4a36a81
3 changed files with 6 additions and 12 deletions

View File

@@ -325,18 +325,14 @@ app.post('/api/events/:slug/rsvp', async (req: Request, res: Response) => {
// Get recipients from event settings
let recipients: string[] = [];
// First try to use the event's email recipients
// Use the event's email recipients
if (eventEmailRecipients) {
recipients = eventEmailRecipients.split(',').map(addr => addr.trim()).filter(Boolean);
}
// If no event recipients, fall back to environment variables
if (recipients.length === 0) {
if (process.env.EMAIL_RECIPIENTS) {
recipients = process.env.EMAIL_RECIPIENTS.split(',').map(addr => addr.trim()).filter(Boolean);
} else if (process.env.EMAIL_USER) {
recipients = [process.env.EMAIL_USER];
}
// If no recipients are set for the event, use the sender email as a fallback
if (recipients.length === 0 && process.env.EMAIL_USER) {
recipients = [process.env.EMAIL_USER];
}
if (recipients.length > 0) {