mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 05:31:14 -05:00
Fix email reply access and threading
This commit is contained in:
@@ -177,6 +177,23 @@ const handler = async (req: Request): Promise<Response> => {
|
||||
const ticketNumber = submission.ticket_number || 'PENDING';
|
||||
const messageId = `<${ticketNumber}.${submission.id}@thrillwiki.com>`;
|
||||
|
||||
// Insert initial message into email thread
|
||||
await supabase
|
||||
.from('contact_email_threads')
|
||||
.insert({
|
||||
submission_id: submission.id,
|
||||
direction: 'inbound',
|
||||
from_email: email.trim().toLowerCase(),
|
||||
to_email: adminEmail,
|
||||
subject: subject.trim(),
|
||||
body_text: message.trim(),
|
||||
message_id: messageId,
|
||||
metadata: {
|
||||
category: category,
|
||||
name: name.trim()
|
||||
}
|
||||
});
|
||||
|
||||
if (forwardEmailKey) {
|
||||
// Send admin notification
|
||||
fetch('https://api.forwardemail.net/v1/emails', {
|
||||
|
||||
Reference in New Issue
Block a user