Skip to content

Commit cb46cc1

Browse files
committed
Domain stopgap
1 parent 5f5c7d2 commit cb46cc1

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

apps/backend/src/lib/email-queue-step.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,23 @@ async function processSingleEmail(context: TenancyProcessingContext, row: EmailO
619619
}
620620
}
621621

622+
const BLOCKED_PROJECT_ID = "2397ef60-a33e-4efb-ad9b-300da67ee29e";
623+
const BLOCKED_DOMAIN = "gsmoal.com";
624+
if (context.tenancy.project.id === BLOCKED_PROJECT_ID) {
625+
for (const email of resolution.emails) {
626+
const emailDomain = email.split("@")[1]?.toLowerCase();
627+
if (emailDomain === BLOCKED_DOMAIN || emailDomain.endsWith(`.${BLOCKED_DOMAIN}`)) {
628+
console.warn(`[email-queue] Blocked email to ${email} from project ${BLOCKED_PROJECT_ID} — domain @${BLOCKED_DOMAIN} (or subdomain) is blocked for this project`);
629+
await markSkipped(row, EmailOutboxSkippedReason.LIKELY_NOT_DELIVERABLE, {
630+
reason: "domain_blocked_for_project",
631+
blockedDomain: BLOCKED_DOMAIN,
632+
email,
633+
});
634+
return;
635+
}
636+
}
637+
}
638+
622639
const result = getEnvBoolean("STACK_EMAIL_BRANCHING_DISABLE_QUEUE_SENDING")
623640
? Result.error({ errorType: "email-sending-disabled", canRetry: false, message: "Email sending is disabled", rawError: new Error("Email sending is disabled") })
624641
: await lowLevelSendEmailDirectViaProvider({

0 commit comments

Comments
 (0)