Erreur 500 Collector - emailcollector.class.php

Hello

Environment:
PHP 7.4.33
Apache/2.4.52 (Ubuntu)
MySQL or MariaDB 5.5.5-10.6.12-MariaDB-0ubuntu0.22.04.1
Current version of Dolibarr (Programs) 18.0.4

I am setting up dolibarr, and I want to configure the collector.
The collector is with M365 & Oauth2.

When the mailbox is empty, the collector connects and tells me that no mail is available.
When an email is present, I get an error 500.

The apache logs :
[Fri Jan 26 16:46:56.730294 2024] [php7:error] [pid 1556] [client 192.168.99.11:56251] PHP Fatal error: Uncaught Error: Object of class Webklex\PHPIMAP\Message could not be converted to string in /usr/share/dolibarr/htdocs/emailcollec
tor/class/emailcollector.class.php:1633\nStack trace:\n#0 /usr/share/dolibarr/htdocs/admin/emailcollector_card.php(239): EmailCollector->doCollectOneCollector()\n#1 {main}\n thrown in /usr/share/dolibarr/htdocs/emailcollector/class/emai
lcollector.class.php on line 1633, referer: https://.../admin/emailcollector_card.php?id=1&action=collecttest&token=3562aadc7b858a5f5483c47877e387c6&page_y=448

Do you have an idea for a correction?

It’s a deepl translation of that : Erreur 500 Collector - emailcollector.class.php - Autres modules natifs - Forum Dolibarr france

Hi Tjeanneau,
i have exact the same problem, i was experimenting with a new installation inkl. 19 Beta with PHP 8.1, the problem must be somwhere in PHP 7 or 8, the problems continue when collecting, it wont move the mail into archiv.
I will be patient and wait for the final Version 19.