Open
Description
Describe the bug
Cannot move or copy Message because if the $status
does not contain a uidnext
key, then the copy or move function just gives up. My server does not give a uidnext
key in the status.
Used config
$client = $cm->make([
'host' => $account->imap_host,
'port' => $account->imap_port,
'encryption' => Account::IMAP_ENCRYPTION_METHODS[$account->imap_encryption_method],
'validate_cert' => $account->imap_certificate_validation,
'username' => $account->imap_username,
'password' => $account->imap_password,
'protocol' => Account::IMAP_PROTOCOLS[$account->imap_protocol],
]);
Code to Reproduce
The troubling code section which produces the reported bug.
$cm = new ClientManager();
$client = $cm->make([
'host' => $account->imap_host,
'port' => $account->imap_port,
'encryption' => Account::IMAP_ENCRYPTION_METHODS[$account->imap_encryption_method],
'validate_cert' => $account->imap_certificate_validation,
'username' => $account->imap_username,
'password' => $account->imap_password,
'protocol' => Account::IMAP_PROTOCOLS[$account->imap_protocol],
]);
$client->connect();
$folder = $client->getFolderByName('INBOX');
$processedFolder = 'INBOX' . ($folder->delimiter) . 'Processed';
$messages = $folder->messages()->all()->markAsRead()->get();
$message = $messages[0];
$message->move($processedFolder);
Expected behavior
Message is moved to "INBOX.Processed" folder.
Screenshots
The message remains in the "INBOX" folder, as shown from the webmail and from Thunderbird.
Server:
- OS: Ubuntu 24.04.1
- PHP: 8.3
- Version: v6.1.0
- Provider: Xserver
Additional context
Xserver does not give a "uidnext" parameter so I can't move or copy the message. Here's what Xserver gives me:
// $client->getConnection()->examineFolder('INBOX.Processed')->validatedData();
[
"flags" => [
[
"\Draft",
"\Answered",
"\Flagged",
"\Deleted",
"\Seen",
"\Recent",
],
],
"exists" => 1,
"recent" => 0,
"uidvalidity" => 742015324,
]
Given this code from Message.php
, then it is expected for the move process to fail if uidnext
is missing.
$this->client->openFolder($folder_path);
$status = $this->client->getConnection()->examineFolder($folder_path)->validatedData();
if (isset($status["uidnext"])) {
// actually move the message
}
return null;