I have an error to connect mailbox with OAuth 2.0, iv'e create an application on office 365 to connect on the OAuth 2.0, and configure the mailbox, when i try to connect it i have this error :
Failed to initialize the mailbox: " Reason: cannot connect to host; error = stream_socket_client(): Unable to connect to ssl://outlook.office365.com:993 (Unknown error) (errno = 0 )
Try to nmap to outlook.office365.com:993. Is the port open? Can you even
get to that server? If not, may be a firewall blocking issue on your side
(or theirs).
I have an error to connect mailbox with OAuth 2.0, iv'e create an
application on office 365 to connect on the OAuth 2.0, and configure the
mailbox, when i try to connect it i have this error :
Failed to initialize the mailbox: " Reason: cannot connect to host; error
= stream_socket_client(): Unable to connect to ssl://
outlook.office365.com:993 (Unknown error) (errno = 0 )
I would try what @kirkpthompson suggested. Your server might not be able to send requests outside.
When generating your token for the first time, only your browser communicates with the distant service, not the iTop server.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Based on the screenshots and message, I don't think there will be many other suggestions to be honest?
But you could try to reach out to Combodo for a more in-depth investigation, or perhaps do some more research on the message you're seeing to try out different solutions, or contact an iTop consultant (such as myself) to outsource the troubleshooting.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you show us your combodo-email-synchro part of your configuration file ?
There's some parameters that can be passed to your imap_options that'll be used when trying to connect to the remote server ( link ssl or novalidate-cert).
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Warning: imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl} in Command line code on line 1
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: Too many login failures (errflg=2) in Unknown on line 0
Notice: PHP Request Shutdown: Too many login failures (errflg=2) in Unknown on line 0
That tell me the login is failed but my login used for connection is a good one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So this time it really can't open a socket to the remote server.
I'm really not sure what's happening, I'll try to reproduce by installing a self signed certificated on my PC when I have some time
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If your server uses SSL to secure a HTTPs connection you probably already have a certificate.
If it's a self signed certificate it might lead to some issues as it's less common
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have an error to connect mailbox with OAuth 2.0, iv'e create an application on office 365 to connect on the OAuth 2.0, and configure the mailbox, when i try to connect it i have this error :
Failed to initialize the mailbox: " Reason: cannot connect to host; error = stream_socket_client(): Unable to connect to ssl://outlook.office365.com:993 (Unknown error) (errno = 0 )
Try to nmap to outlook.office365.com:993. Is the port open? Can you even
get to that server? If not, may be a firewall blocking issue on your side
(or theirs).
On Fri, Dec 20, 2024, 06:28 Bon Cédric cedric93@users.sourceforge.net
wrote:
You were able to generate a proper OAuth 2.0 token?
Can you show a screenshot of your settings? (censor email)
Hello, please find the screenshot.
Yes the token from office is generate with succes.
Last edit: Bon Cédric 2025-01-06
Hi,
I would try what @kirkpthompson suggested. Your server might not be able to send requests outside.
When generating your token for the first time, only your browser communicates with the distant service, not the iTop server.
Hi,
Ive chek our serveur and is able to send request outside the port 993 is open.
Hello any news ? please
Based on the screenshots and message, I don't think there will be many other suggestions to be honest?
But you could try to reach out to Combodo for a more in-depth investigation, or perhaps do some more research on the message you're seeing to try out different solutions, or contact an iTop consultant (such as myself) to outsource the troubleshooting.
Can you show us your
combodo-email-synchro
part of your configuration file ?There's some parameters that can be passed to your
imap_options
that'll be used when trying to connect to the remote server ( linkssl
ornovalidate-cert
).This is the part of email Synchro.
),
'combodo-email-synchro' => array (
'notify_errors_to' => '',
'notify_errors_from' => '',
'debug' => true,
'periodicity' => 30,
'retention_period' => 1,
'body_parts_order' => 'text/html,text/plain',
'pop3_auth_option' => 'USER',
'imap_options' => array (
0 => 'imap',
1 => 'ssl',
),
Maybe your can try to add
novalidate-cert
to your imap_options in case that's a self signed certificate issue:If that still fails you can try to connect to your mailbox using PHP in command line and see if you have similar issue:
add the novalidate-cert don't work.
I try the command to connect and the error is :
Warning: imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl} in Command line code on line 1
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
Notice: PHP Request Shutdown: LOGIN failed. (errflg=1) in Unknown on line 0
PHP Notice: PHP Request Shutdown: Too many login failures (errflg=2) in Unknown on line 0
Notice: PHP Request Shutdown: Too many login failures (errflg=2) in Unknown on line 0
That tell me the login is failed but my login used for connection is a good one.
The login failed is expected as Microsoft disallowed login/password authentication in IMAP, but at least we managed to get to the login process!
Could you add (or replace) this entry in your configuration file and open the OAuth mailbox again (so the error message is displayed):
Then could you show us what's logged in your
log/error.log
file please ?This is that i have i my error log file :
2025-01-17 09:26:15 | Debug | 3 | IMAPOAuthEmailSource Start for outlook.office365.com | OAuth |||
2025-01-17 09:26:15 | Error | 3 | Failed to initialize the mailbox: **(mailbox user). Reason: cannot connect to host; error = stream_socket_client(): Unable to connect to ssl://outlook.office365.com:993 (Unknown error) (errno = 0 ) | IssueLog |||
array (
'file' => 'C:\xampp\htdocs\itop\lib\laminas\laminas-mail\src\Protocol\ProtocolTrait.php',
'line' => 110,
'exception.class' => 'Laminas\Mail\Protocol\Exception\RuntimeException',
'exception.stack' => '#0 C:\xampp\htdocs\itop\lib\laminas\laminas-mail\src\Protocol\Imap.php(118): Laminas\Mail\Protocol\Imap->setupSocket(\'ssl\', \'outlook.office3...\', 993, 30)
C:\xampp\htdocs\itop\env-production\combodo-oauth-email-synchro\src\Service\IMAPOAuthStorage.php(48): Laminas\Mail\Protocol\Imap->connect(\'outlook.office3...\', 993, \'ssl\')
C:\xampp\htdocs\itop\env-production\combodo-oauth-email-synchro\src\Service\IMAPOAuthEmailSource.php(51): Combodo\iTop\Extension\Service\IMAPOAuthStorage->__construct(Object(stdClass))
C:\xampp\htdocs\itop\env-production\combodo-oauth-email-synchro\model.combodo-oauth-email-synchro.php(113): Combodo\iTop\Extension\Service\IMAPOAuthEmailSource->__construct(Object(MailInboxOAuth))
C:\xampp\htdocs\itop\env-production\combodo-email-synchro\ajax.php(58): MailInboxOAuth->GetEmailSource()
C:\xampp\htdocs\itop\env-production\combodo-email-synchro\ajax.php(256): GetMailboxContent(Object(Combodo\iTop\Application\WebPage\AjaxPage), Object(MailInboxOAuth))
{main}',
)
2025-01-17 09:27:56 | Debug | 3 | GetAuthorizationUrl for OAuthClientAzure::3 | OAuth |||
2025-01-17 09:27:58 | Debug | 3 | GetDisplayAuthenticationResults for OAuthClientAzure::3 | OAuth |||
2025-01-17 09:27:58 | Info | 3 | Token recreated for OAuthClientAzure:3 | IssueLog |||
So this time it really can't open a socket to the remote server.
I'm really not sure what's happening, I'll try to reproduce by installing a self signed certificated on my PC when I have some time
Ok thanks, we need to have a certificate on our computer ?
If your server uses SSL to secure a HTTPs connection you probably already have a certificate.
If it's a self signed certificate it might lead to some issues as it's less common