Skip to content

Conversation

@stonebuzz
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

This PR fixes an issue where the OAuth IMAP plugin fails to open folders when the mailbox language is not English (e.g., French, German, etc.).

Previously, the plugin used the localized folder name (e.g. “Boîte de réception”) instead of the IMAP global name (e.g. “INBOX”) when selecting folders.
This caused the collector to fail with:

Laminas\Mail\Storage\Exception\RuntimeException: cannot change folder, maybe it does not exist

Updated folder selection logic to rely on the data-globalname attribute instead of the localized display name (local_name).

Screenshots (if appropriate):

@trasher trasher requested a review from cedric-anne November 6, 2025 08:36
@cedric-anne cedric-anne added this to the 11.0.3 milestone Nov 6, 2025
@cedric-anne cedric-anne added the bug label Nov 6, 2025
@cedric-anne cedric-anne merged commit 21ec565 into glpi-project:11.0/bugfixes Nov 6, 2025
10 checks passed
@lheureuxj2
Copy link

Have change line of /var/www/html/templates/pages/setup/mailcollector/setup_form.html.twig

have change 2 line of your commit and have clear cache same issues

image

[2025-11-06 13:42:14] glpi.ERROR: *** Caught Laminas\Mail\Storage\Exception\RuntimeException: cannot change folder, maybe it does not exist Backtrace : ...r/laminas/laminas-mail/src/Storage/Imap.php:404 ...authimap/inc/imap/imapoauthstorage.class.php:82 Laminas\Mail\Storage\Imap->selectFolder() ...oauthimap/inc/mailcollectorfeature.class.php:97 GlpiPlugin\Oauthimap\Imap\ImapOauthStorage->__construct() ./src/Toolbox.php:2013 GlpiPlugin\Oauthimap\MailCollectorFeature::GlpiPlugin\Oauthimap\{closure}() ./src/MailCollector.php:1285 Toolbox::getMailServerStorageInstance() ./src/MailCollector.php:584 MailCollector->connect() ...temType/Form/MailCollectorFormController.php:56 MailCollector->collect() ./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\ItemType\Form\MailCollectorFormController->__invoke() ./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKernel\HttpKernel->handleRaw() ./vendor/symfony/http-kernel/Kernel.php:197 Symfony\Component\HttpKernel\HttpKernel->handle() ./public/index.php:70 Symfony\Component\HttpKernel\Kernel->handle()

@stonebuzz
Copy link
Contributor Author

@lheureuxj2 have you reconfigurer folder ?

@lheureuxj2
Copy link

what you mean ?

@stonebuzz
Copy link
Contributor Author

Can you reconfigure folder configuration

I think data saved on DB are Always use local name

Maybe you need to delete / create new receiver

@lheureuxj2
Copy link

lheureuxj2 commented Nov 6, 2025

I deleted the collector and created a new one with the same auth2 from your plugin, and I just cleared the cache, but I still get the same error.

[2025-11-06 19:59:43] glpi.ERROR: *** Caught Laminas\Mail\Storage\Exception\Ru ntimeException: cannot change folder, maybe it does not exist Backtrace : ...r/laminas/laminas-mail/src/Storage/Imap.php:404 ...authimap/inc/imap/imapoauthstorage.class.php:82 Laminas\Mail\Storage\Imap-> selectFolder() ...oauthimap/inc/mailcollectorfeature.class.php:97 GlpiPlugin\Oauthimap\Imap\I mapOauthStorage->__construct() ./src/Toolbox.php:2013 GlpiPlugin\Oauthimap\MailCo llectorFeature::GlpiPlugin\Oauthimap\{closure}() ./src/MailCollector.php:1285 Toolbox::getMailServerStora geInstance() ./src/MailCollector.php:298 MailCollector->connect() ./ajax/mailcollector.php:80 MailCollector->displayFolde rsList() ...Glpi/Controller/LegacyFileLoadController.php:64 require() ./vendor/symfony/http-kernel/HttpKernel.php:181 Glpi\Controller\LegacyFileL oadController->__invoke() ./vendor/symfony/http-kernel/HttpKernel.php:76 Symfony\Component\HttpKerne l\HttpKernel->handleRaw() ./vendor/symfony/http-kernel/Kernel.php:197 Symfony\Component\HttpKerne l\HttpKernel->handle() ./public/index.php:70 Symfony\Component\HttpKerne l\Kernel->handle()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Probleme with plugin

4 participants