Skip to content

Commit

Permalink
Fix separating replies from Proton emails - closes #4537
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Feb 3, 2025
1 parent 34b910b commit 94269e1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Console/Commands/FetchEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '<div class="protonmail_quote">') < mb_strpos($body, '<html')
) {
$body = mb_substr($body, 0, mb_strpos($body, '<div class="protonmail_quote">'));
}

// Split by <html>
$htmls = [];
preg_match_all("/<html[^>]*>(.*?)<\/html>/is", $body, $htmls);
Expand Down
1 change: 1 addition & 0 deletions app/Misc/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Mail
// <div class="gmail_quote" style="font-family:sans-serif;">
'<div class="gmail_quote">', // Gmail
'<div class="gmail_quote" ', // Gmail
'<div class="protonmail_quote">', // https://github.com/freescout-help-desk/freescout/issues/4537
'<div id="appendonsend"></div>', // Outlook / Live / Hotmail / Microsoft
'<div name="quote" ',
'yahoo_quoted_', // Yahoo, full: <div id=3D"ydp6h4f5c59yahoo_quoted_2937493705"
Expand Down

0 comments on commit 94269e1

Please sign in to comment.