From 94269e1dea0c53bf8f2ebc0bec4cebf31bb0550f Mon Sep 17 00:00:00 2001 From: FreeScout Date: Sun, 2 Feb 2025 22:20:46 -0800 Subject: [PATCH] Fix separating replies from Proton emails - closes #4537 --- app/Console/Commands/FetchEmails.php | 9 +++++++++ app/Misc/Mail.php | 1 + 2 files changed, 10 insertions(+) diff --git a/app/Console/Commands/FetchEmails.php b/app/Console/Commands/FetchEmails.php index 5c8faeb17..5751f9a35 100644 --- a/app/Console/Commands/FetchEmails.php +++ b/app/Console/Commands/FetchEmails.php @@ -1359,6 +1359,15 @@ public function separateReply($body, $is_html, $is_reply, $user_reply_to_notific if ($is_html) { // Extract body content from HTML + + // Proton has it's own unique way of placing replies: + // https://github.com/freescout-help-desk/freescout/issues/4537#issuecomment-2629836738 + if ($is_reply + && mb_strpos($body, '
') < mb_strpos($body, '')); + } + // Split by $htmls = []; preg_match_all("/]*>(.*?)<\/html>/is", $body, $htmls); diff --git a/app/Misc/Mail.php b/app/Misc/Mail.php index e76f6d8cf..1a5e98a3c 100644 --- a/app/Misc/Mail.php +++ b/app/Misc/Mail.php @@ -65,6 +65,7 @@ class Mail //
'
', // Gmail '
', // https://github.com/freescout-help-desk/freescout/issues/4537 '
', // Outlook / Live / Hotmail / Microsoft '