Skip to content

Commit

Permalink
Add more message operations
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Feb 8, 2025
1 parent 7d4b2a7 commit c47006f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,46 @@ public function flag(array|string $flag, string $operation = '+', bool $expunge
}
}

/**
* Copy the message to the given folder.
*/
public function copy(string $folder, bool $expunge = true): void
{
$this->folder->mailbox()
->connection()
->copyMessage($folder, $this->folder->path(), $this->uid);

if ($expunge) {
$this->folder->expunge();
}
}

/**
* Move the message to the given folder.
*/
public function move(string $folder, bool $expunge = true): void
{
$this->folder->mailbox()
->connection()
->moveMessage($folder, $this->folder->path(), $this->uid);

if ($expunge) {
$this->folder->expunge();
}
}

/**
* Delete the message.
*/
public function delete(bool $expunge = true): void
{
$this->markDeleted();

if ($expunge) {
$this->folder->expunge();
}
}

/**
* Parse the message into a MailMimeMessage instance.
*/
Expand Down

0 comments on commit c47006f

Please sign in to comment.