Hello!
I am not sure of this is a bug or a configuration issue, but I have problems connecting SuiteCRM (version 8.7.0) with Office 365 email accounts. OAuth configuration works, but all access to email folders show no result. The logs contain these errors:
[Wed Oct 09 14:33:36.825879 2024] [php:warn] [pid 4192254:tid 4192254] [client a.b.c.d:49345] PHP Warning: open(): Couldn't open stream {outlook.office365.com:993/service=imap}INBOX in /var/www/html/public/legacy/modules/InboundEmail/InboundEmail.php on line 6593. Source code in /var/www/html/vendor/javanile/php-imap2/src/Connection.php on line 81, referer: https://suitecrm.example. net/legacy/index.php?return_module=Emails&return_action=DetailView&module=Emails&action=index
The error PHP Warning: open(): Couldn’t open stream appears with other IMAP servers as well (testing platforms, self-signed certificate, “regular” certificate). Debugging shows that the TCP connection works, TLS maybe, but no IMAP commands go through the stream. Does anyone else have this problem?
Yes, the Office 365 part is completely configured. It’s just that the TLS connections fails. SuiteCRM doesn’t even get to the point of talking to Office 365. I double-checked TLS verification and other TLS settings. The system certifcate authorities works for verifying the trust chain, only the IMAP open call from the PHP modules does not work. Is this a know problem?
@rsp that has do with outbound SMTP, I think the original poster and the one above are having trouble with inbound IMAP.
I have detailed step by step notes on how to set this up. (they are all from my clients so I can’t just share it here) If you tell me where you are getting stuck I might be able to shed light.
One of the key things is when setting up the inbound “Do not click on test connection” Instead click on the folders pick button. If you get folders. You are connected and are done. If you do not get folders, likely something isn’t configured right on the Azure side, or the provider connection isn’t setup properly.
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "IMAP open error | debug data"
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com:993\/service=imap\/ssl\/tls\/validate-cert\/secure}INBOX"
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "ImapHandler:open: alxxxx@xxxxxxxxx.com"
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "ImapHandler:open: password is empty: no"
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "ImapHandler:open: 512"
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "IMAP open error | debug data end "
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] ImapHandler trying to use a non valid resource stream.
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "IMAP open error:Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
And in Apache log:
[14-Feb-2025 15:05:16 Europe/Madrid] PHP Warning: open(): Couldn't open stream {outlook.office365.com:993/service=imap/ssl/tls/validate-cert/secure}INBOX in /usr/home/suitecrm.sinergiacrm.org/web/modules/InboundEmail/InboundEmail.php on line 6595. Source code in /usr/home/suitecrm.sinergiacrm.org/web/vendor/javanile/php-imap2/src/Connection.php on line 81
We tried same Azure APP in a GLPI installation, and it worked flawlesly. The differences we find is the Connection String, that in this case is: {outlook.office365.com/imap-oauth-1/ssl}INBOX
Tried to set that Connection string to the Inbound Account in SuiteCRM, but still nothing… In this case an Empty host error is displayed:
Fri Feb 14 15:05:16 2025 [1540597][1][FATAL] An Imap error detected: "Can not authenticate to IMAP server: A0001 NO AUTHENTICATE failed."
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "IMAP open error: Can not authenticate to IMAP server: Empty host"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "IMAP open error | debug data"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "ImapHandler:open: {outlook.office365.com\/imap-oauth-1\/ssl}INBOX"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "ImapHandler:open: axxxxxxxx@xxxxxxxxoft.com"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "ImapHandler:open: password is empty: no"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "ImapHandler:open: 512"
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "IMAP open error | debug data end "
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] ImapHandler trying to use a non valid resource stream.
Fri Feb 14 15:10:40 2025 [1557439][1][FATAL] An Imap error detected: "IMAP open error:Can not authenticate to IMAP server: Empty host"
We weren’t writing the scope “IMAP.AccessAsUser.All” correctly. It should be always followed by Outlook URL. Like this: https://outlook.office.com/IMAP.AccessAsUser.All
SuiteCRM documentation is correct. We were confused by the indication in Azure Admin site: