Skip to content

Commit

Permalink
Fix moving emails to a folder on fetching on mail servers not support…
Browse files Browse the repository at this point in the history
…ing MOVE command - closes #4313
  • Loading branch information
freescout-help-desk committed Nov 8, 2024
1 parent 910edca commit fc7f4bf
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,27 @@ public function moveMessage(string $folder, $from, $to = null, $uid = IMAP::ST_U
$set = $this->buildSet($from, $to);
$command = $this->buildUIDCommand("MOVE", $uid);

return (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
//return (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
$result = (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);

// Fallback to COPY, STORE and EXPUNGE.
// https://github.com/freescout-help-desk/freescout/issues/4313
if (!$result) {
$result = $this->copyMessage($folder, $from, $to);
if (!$result) {
return false;
}
$result = $this->store(['\Deleted'], $from, $to);
if (!$result) {
return false;
}

$this->expunge();

return true;
}

return $result;
}

/**
Expand Down

0 comments on commit fc7f4bf

Please sign in to comment.