diff --git a/supabase/functions/send-admin-email-reply/index.ts b/supabase/functions/send-admin-email-reply/index.ts index a5f2d4a0..be031466 100644 --- a/supabase/functions/send-admin-email-reply/index.ts +++ b/supabase/functions/send-admin-email-reply/index.ts @@ -67,6 +67,9 @@ const handler = async (req: Request): Promise => { }, 400, corsHeaders); } + // Get admin email from environment variable + const adminEmail = Deno.env.get('ADMIN_EMAIL_ADDRESS') || 'admins@thrillwiki.com'; + // Fetch admin's profile for signature const { data: adminProfile } = await supabase .from('profiles') @@ -144,7 +147,7 @@ const handler = async (req: Request): Promise => { 'Content-Type': 'application/json' }, body: JSON.stringify({ - from: 'ThrillWiki Admin ', + from: `ThrillWiki Admin <${adminEmail}>`, to: `${submission.name} <${submission.email}>`, subject: finalSubject, text: finalReplyBody, @@ -176,7 +179,7 @@ const handler = async (req: Request): Promise => { message_id: messageId, in_reply_to: inReplyTo, reference_chain: [inReplyTo], - from_email: 'admin@thrillwiki.com', + from_email: adminEmail, to_email: submission.email, subject: finalSubject, body_text: finalReplyBody,