Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy/Move Message with utf7 folder path #559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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()) {
Expand All @@ -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
Expand All @@ -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();

Expand All @@ -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()) {
Expand Down