From 362e9cf1e66550cc7e8399e4f97baa609730a9d4 Mon Sep 17 00:00:00 2001 From: FreeScout Date: Wed, 24 Jul 2019 23:58:00 -0700 Subject: [PATCH] Check mailbox when fetching replies --- app/Console/Commands/FetchEmails.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Console/Commands/FetchEmails.php b/app/Console/Commands/FetchEmails.php index ebc9b973..110ed2e8 100644 --- a/app/Console/Commands/FetchEmails.php +++ b/app/Console/Commands/FetchEmails.php @@ -380,6 +380,15 @@ class FetchEmails extends Command } } + // Make sure that prev_thread belongs to the current mailbox. + // It may happen when forwarding conversation for example. + if ($prev_thread) { + if ($prev_thread->conversation->mailbox_id != $mailbox->id) { + $prev_thread = null; + $is_reply = false; + } + } + // Get body if (!$html_body) { // Get body and do not replace :cid with images base64