diff --git a/app/Misc/Mail.php b/app/Misc/Mail.php index e6fb3936a..7a7e1fa81 100644 --- a/app/Misc/Mail.php +++ b/app/Misc/Mail.php @@ -733,6 +733,11 @@ public static function fetchMessage($mailbox, $message_id, $message_date = null) foreach ($imap_folders as $folder_name) { try { $folder = self::getImapFolder($client, $folder_name); + + if (!$folder) { + \Log::error('('.$mailbox->name.') Show Original - folder not found: '.$folder_name); + continue; + } // Message-ID: <123@123.com> $query = $folder->query() ->text('<'.$message_id.'>') @@ -763,7 +768,7 @@ public static function fetchMessage($mailbox, $message_id, $message_date = null) $query = $folder->query()->text('<'.$message_id.'>')->leaveUnread()->limit(1)->setCharset(null); if ($message_date) { $query->since($message_date->subDays(7)); - $query->before($message_date->addDays(7)); + $query->before($message_date->addDays(14)); } $messages = $query->get(); $no_charset = true; diff --git a/app/Thread.php b/app/Thread.php index 2d7591308..c8cf77db5 100644 --- a/app/Thread.php +++ b/app/Thread.php @@ -1393,6 +1393,12 @@ public function fetchBody() { $message = \MailHelper::fetchMessage($this->conversation->mailbox, $this->message_id, $this->getMailDate()); + // Try without limiting by date. + // https://github.com/freescout-helpdesk/freescout/issues/3658 + if (!$message) { + $message = \MailHelper::fetchMessage($this->conversation->mailbox, $this->message_id); + } + if (!$message) { return ''; }