Skip to content

Commit

Permalink
Improve the email search by Message-Id in Show Original window - closes
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Oct 4, 2024
1 parent 6af3896 commit 980035f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Misc/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,10 @@ public static function fetchMessage($mailbox, $message_id, $message_date = null)
continue;
}
// Message-ID: <[email protected]>
$search_message_id = addcslashes($message_id, '\"');
$query = $folder->query()
->text('<'.$message_id.'>')
//->text('<'.$message_id.'>')
->whereMessageId('"<'.$search_message_id.'>"')
->leaveUnread()
->limit(1);

Expand All @@ -826,7 +828,8 @@ public static function fetchMessage($mailbox, $message_id, $message_date = null)
if ($last_error && stristr($last_error, 'The specified charset is not supported')) {
// Solution for MS mailboxes.
// https://github.com/freescout-helpdesk/freescout/issues/176
$query = $folder->query()->text('<'.$message_id.'>')->leaveUnread()->limit(1)->setCharset(null);
//$query = $folder->query()->text('<'.$message_id.'>')->leaveUnread()->limit(1)->setCharset(null);
$query = $folder->query()->whereMessageId('"<'.$search_message_id.'>"')->leaveUnread()->limit(1)->setCharset(null);
if ($message_date) {
$query->since($message_date->subDays(7));
$query->before($message_date->addDays(14));
Expand Down

0 comments on commit 980035f

Please sign in to comment.