Getting imap_mail_move() expects parameter 1 to be resource, object given
Dhavalptel opened this issue · 2 comments
Dhavalptel commented
Describe the bug
Getting imap_mail_move() expects parameter 1 to be resource, object given
To Reproduce
$client = $cm->make([
'host' => 'outlook.office365.com',
'port' => 993,
'encryption' => 'ssl',
'validate_cert' => true,
'username' => IMAP_USERNAME,
'password' => ACCESS_TOKEN,
'protocol' => 'imap',
'authentication' => "oauth",
]);
imap_mail_move($client->getConnection(), $range, $processedfolder, 1)
@Webklex I'm using this $client->getConnection()
which returns object, Do we need any other parameter at position 1?
Let me know
Thanks!
inkarnation commented
seems imap_mail_move
expects an IMAP\Connection
as first parameter see https://www.php.net/manual/de/function.imap-mail-move.php. Alternatively you could use the build in move function: $cm->moveMessage(...);
or $cm->moveManyMessages(...);
see https://github.com/Webklex/php-imap/blob/master/src/Connection/Protocols/ImapProtocol.php#L976
Dhavalptel commented
@inkarnation Yes, I followed the same and was able to fix it.