So, I've spent the last few days running this issue down, and I actually have a solution (or a workaround?), but I just wanted to ask if it's really the best way to handle the situation.
I'm running CiviCRM 5.21.0 on Joomla 3.9.15 and was looking at bounce processing and the Fuzion Transactional Email extension. I was setting up an IMAP account to handle the bounces, but every time I ran the fetch_bounces scheduled job, it would come back with "The IMAP server did not accept the username and/or password". Well, I know the username and password are correct.
Long story short(er), my mail server (I host in-house), Smartermail 14.7, does the same thing that GMail does - instead of an immediate "OK LOGIN completed" response, it gives the "* CAPABILITY" line first.
I couldn't find anywhere in the code where it might dynamically figure out that the server is a gmail server, so I just changed the $serverType on line 331 of /administrator/components/com_civicrm/vendor/zetacomponents/mail/src/transports/imap/imap_transport.php from null to self::SERVER_GIMAP, and now the authentication error is gone.
Is this the best way to do this, or is there a better way? I'm guessing that any time I update CiviCRM, I'm going to have to re-do this change.