Webklex / laravel-imap

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.
https://www.php-imap.com
MIT License
637 stars 182 forks source link

Getting imap_mail_move() expects parameter 1 to be resource, object given #463

Closed Dhavalptel closed 1 year ago

Dhavalptel commented 1 year ago

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 1 year ago

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 1 year ago

@inkarnation Yes, I followed the same and was able to fix it.