From de1a94a098f54964a3ed88773b2bdf739145a69b Mon Sep 17 00:00:00 2001 From: Eliezer Steinbock <3090527+elie222@users.noreply.github.com> Date: Wed, 19 Nov 2025 09:48:43 +0200 Subject: [PATCH] Skip cold email blocker on outlook if we've emailed the person --- apps/web/utils/email/microsoft.ts | 11 +++++------ version.txt | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/web/utils/email/microsoft.ts b/apps/web/utils/email/microsoft.ts index 48d6a78cd2..8588a5c3ae 100644 --- a/apps/web/utils/email/microsoft.ts +++ b/apps/web/utils/email/microsoft.ts @@ -1186,17 +1186,16 @@ export class OutlookProvider implements EmailProvider { .getClient() .api("/me/messages") .filter( - `from/emailAddress/address eq '${escapeODataString(options.from)}' and receivedDateTime lt ${options.date.toISOString()}`, + `(toRecipients/any(a:a/emailAddress/address eq '${escapeODataString(options.from)}') and sentDateTime lt ${options.date.toISOString()}) or (from/emailAddress/address eq '${escapeODataString(options.from)}' and receivedDateTime lt ${options.date.toISOString()})`, ) .top(2) .select("id") .get(); - // Check if there are any messages from this sender before the current date - // and exclude the current message - const hasPreviousEmail = response.value.some( - (message) => message.id !== options.messageId, - ); + // If we have any outgoing emails, or any incoming emails (excluding current message) + const hasPreviousEmail = + response.value.length > 0 && + response.value.some((message) => message.id !== options.messageId); return hasPreviousEmail; } catch (error) { diff --git a/version.txt b/version.txt index c39801ce32..234ca1691d 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v2.20.8 +v2.20.9