From a130c43bcb29ba1a1c3275cfce62597050528cfd Mon Sep 17 00:00:00 2001 From: Rene Rudnick Date: Tue, 4 Mar 2025 12:34:05 +0100 Subject: [PATCH] Copy/Move Message with utf7 folder path Messages can be moved/copied to a folder with umlauts. --- src/Message.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Message.php b/src/Message.php index 3f4fa90b..9d15a7b8 100755 --- a/src/Message.php +++ b/src/Message.php @@ -983,6 +983,7 @@ protected function fetchThreadByMessageId(MessageCollection &$thread, string $me * Copy the current Messages to a mailbox * @param string $folder_path * @param boolean $expunge + * @param bool $utf7 * * @return null|Message * @throws AuthFailedException @@ -999,7 +1000,7 @@ protected function fetchThreadByMessageId(MessageCollection &$thread, string $me * @throws RuntimeException * @throws ResponseException */ - public function copy(string $folder_path, bool $expunge = false): ?Message { + public function copy(string $folder_path, bool $expunge = false, bool $utf7 = false): ?Message { $this->client->openFolder($folder_path); $status = $this->client->getConnection()->examineFolder($folder_path)->validatedData(); @@ -1010,7 +1011,7 @@ public function copy(string $folder_path, bool $expunge = false): ?Message { } /** @var Folder $folder */ - $folder = $this->client->getFolderByPath($folder_path); + $folder = $this->client->getFolderByPath($folder_path, $utf7); $this->client->openFolder($this->folder_path); if ($this->client->getConnection()->copyMessage($folder->path, $this->getSequenceId(), null, $this->sequence)->validatedData()) { @@ -1025,6 +1026,7 @@ public function copy(string $folder_path, bool $expunge = false): ?Message { * Move the current Messages to a mailbox * @param string $folder_path * @param boolean $expunge + * @param bool $utf7 * * @return Message|null * @throws AuthFailedException @@ -1041,7 +1043,7 @@ public function copy(string $folder_path, bool $expunge = false): ?Message { * @throws RuntimeException * @throws ResponseException */ - public function move(string $folder_path, bool $expunge = false): ?Message { + public function move(string $folder_path, bool $expunge = false, bool $utf7 = false): ?Message { $this->client->openFolder($folder_path); $status = $this->client->getConnection()->examineFolder($folder_path)->validatedData(); @@ -1052,7 +1054,7 @@ public function move(string $folder_path, bool $expunge = false): ?Message { } /** @var Folder $folder */ - $folder = $this->client->getFolderByPath($folder_path); + $folder = $this->client->getFolderByPath($folder_path, $utf7); $this->client->openFolder($this->folder_path); if ($this->client->getConnection()->moveMessage($folder->path, $this->getSequenceId(), null, $this->sequence)->validatedData()) {