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

Implement move with imap_mail_copy+CP_MOVE #495

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ wait-for-it:
.PHONY: start-imap-server
start-imap-server: wait-for-it
docker run --name=ddeboer_imap_server --detach --rm --publish 10993:993 --env MAILNAME=test.test --env [email protected] --env MAIL_PASS=p4ssword antespi/docker-imap-devel:latest
./wait-for-it 10993
./wait-for-it localhost:10993

.PHONY: stop-imap-server
stop-imap-server:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ Move a message to another mailbox:
```php
$mailbox = $connection->getMailbox('another-mailbox');
$message->move($mailbox);
$connection->expunge();
```

Deleting messages:
Expand Down
2 changes: 1 addition & 1 deletion src/Mailbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function getThread(): array
*/
public function move($numbers, MailboxInterface $mailbox): void
{
if (!\imap_mail_move($this->resource->getStream(), $this->prepareMessageIds($numbers), $mailbox->getEncodedName(), \CP_UID)) {
if (!\imap_mail_copy($this->resource->getStream(), $this->prepareMessageIds($numbers), $mailbox->getEncodedName(), \CP_UID | \CP_MOVE)) {
throw new MessageMoveException(\sprintf('Messages cannot be moved to "%s"', $mailbox->getName()));
}
}
Expand Down