diff --git a/apps/server/src/thread-workflow-utils/index.ts b/apps/server/src/thread-workflow-utils/index.ts index 26fee86ae3..6c1d04c605 100644 --- a/apps/server/src/thread-workflow-utils/index.ts +++ b/apps/server/src/thread-workflow-utils/index.ts @@ -3,6 +3,15 @@ import { composeEmail } from '../trpc/routes/ai/compose'; import { type ParsedMessage } from '../types'; import { connection } from '../db/schema'; +const dontReplyTo = new Set([ + 'no-reply@gmail.com', + 'noreply@gmail.com', + 'do-not-reply@gmail.com', + 'do-not-reply@gmail.com', + 'notifications@github.com', + 'info@e-mail.xing.com', +]); + const shouldGenerateDraft = async ( thread: IGetThreadResponse, foundConnection: typeof connection.$inferSelect, @@ -38,6 +47,11 @@ const shouldGenerateDraft = async ( return false; } + if (dontReplyTo.has(senderEmail)) { + console.log('[SHOULD_GENERATE_DRAFT] Message is from a dont reply to email, skipping draft'); + return false; + } + if (latestMessage.receivedOn) { const messageDate = new Date(latestMessage.receivedOn); const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);