Problems with imap authentication - Inbound Account

When defining a personal Inbound Mail Accounts (from administrator) choosing auth type “Basic Auth” and putting correct username and password, when I try to select the monitored folder, a blank list appear.

Looking at dovecot log on server I obtain:
May 17 23:02:24 imap-login: Info: Disconnected (tried to use unsupported auth mechanism): user=<>, method=XOAUTH2, rip=10.20.66.8, lip=10.20.66.2, session=

So 2 problems: 1) the method is XOAUTH2, and it shouldn’t. The user is <>, and it should instead be the correct user.

Access Log show the correct call:
10.20.66.20 - - [17/May/2023:23:04:40 +0200] “GET /legacy/themes/suite8/css/bootstrap.min.css HTTP/1.1” 404 527 “https://xxx.yyy.com/legacy/index.php?module=ExternalOAuthConnection&action=Popup&mode=single&create=true&field_to_name[]=name” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36”

10.20.66.20 - - [17/May/2023:23:04:45 +0200] “POST /legacy/index.php?module=InboundEmail&to_pdf=1&action=Popup&target=Popup&target1=Popup&server_url=xxx.yyy.com&email_user=CORRECTUSER&protocol=imap&port=143&email_password=&mailbox=INBOX&ssl=false&ie_id=&personal=true HTTP/1.1” 200 1170 “https://xxx.yyy.com/legacy/index.php?is_personal=1&type=personal&module=InboundEmail&action=EditView” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36”

But when we look at error.log we obtain warning which can explain the NULL User in dovecot:
[Wed May 17 22:59:37.834624 2023] [php7:notice] [pid 4307] [client 10.20.66.20:61649] PHP Notice: Undefined index: foldersList in /var/www/suitecrm8-vm/public/legacy/modules/InboundEmail/ShowInboundFoldersList.php on line 146, referer: https://xxx.yyy.com/legacy/index.php?is_personal=1&type=personal&module=InboundEmail&action=EditView
[Wed May 17 22:59:37.834712 2023] [php7:notice] [pid 4307] [client 10.20.66.20:61649] PHP Notice: Undefined variable: requestMailBox in /var/www/suitecrm8-vm/public/legacy/modules/InboundEmail/ShowInboundFoldersList.php on line 248, referer: https://xxx.yyy.com/legacy/index.php?is_personal=1&type=personal&module=InboundEmail&action=EditView
[Wed May 17 22:59:37.834784 2023] [php7:warn] [pid 4307] [client 10.20.66.20:61649] PHP Warning: implode(): Invalid arguments passed in /var/www/suitecrm8-vm/public/legacy/modules/InboundEmail/ShowInboundFoldersList.php on line 248, referer: https://xxx.yyy.com/legacy/index.php?is_personal=1&type=personal&module=InboundEmail&action=EditView

How can we fix this?
Thanks

Update: after restarting browser and server, leaving untouched the auth type on “basic auth”, testing connections gives “Connection Succesful”.

However, no folder list is given. Setting DEBUG level on suitecrm, I obtain the following:

Thu May 18 08:12:31 2023 [7519][1][DEBUG] Using imap handler class: ImapHandler
Thu May 18 08:12:31 2023 [7519][1][DEBUG] ImapHandlerFactory will using a ImapHandler
Thu May 18 08:12:31 2023 [7519][1][DEBUG] ---------------STARTING FINDOPTIMUMS LOOP----------------
Thu May 18 08:12:31 2023 [7519][1][DEBUG] 1: I-E testing string: {yyy.xxx.com:993/service=imap/ssl/tls/validate-cert/secure}INBOX
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to set a non valid resource az stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][DEBUG] 1: I-E found good connect using [{yyy.xxx.com:993/service=imap/ssl/tls/validate-cert/secure}INBOX]
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][DEBUG] 1: I-E clearing error and alert stacks.
Thu May 18 08:12:31 2023 [7519][1][DEBUG] ---------------end FINDOPTIMUMS LOOP----------------
Thu May 18 08:12:31 2023 [7519][1][WARN] Requested folder is not defined
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] ImapHandler trying to use a non valid resource stream.
Thu May 18 08:12:31 2023 [7519][1][WARN] Connection is not a valid resource.
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Hook called: InboundEmail::after_ui_frame
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Creating new instance of hook class hooks without parameters
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Creating new instance of hook class AssignGroups without parameters
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Hook called: ::after_ui_footer
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Creating new instance of hook class AssignGroups without parameters
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Hook called: ::server_round_trip
Thu May 18 08:12:31 2023 [7519][1][DEBUG] Calling MySQLi::disconnect()

Any idea on how to solve this? System is a Ubuntu 22.04, suitecrm 8.2.4, php 7.4
Mail server is on ubuntu 20.04, dovecot as SASL authenticator, perfectly working on SSL port 993

Thank you

When you run this command from the command line:

pear channel-update pear.php.net 
pear install Auth_SASL 
sudo /opt/bitnami/scripts/apache/reload.sh // for container
sudo systemctl reload apache2  // for linux

…and go to Admin, Email, New inbound email account again, what’s the behavior?

EDIT: you may need to fully restart apache to get this new package used by PHP.
In the container, run:
sudo /opt/bitnami/scripts/apache/restart.sh , this will also restart the container.
In linux, run:
sudo systemctl restart apache2

Thank you,
I switched to odoo, more robust and complete solution!

All the best