Webklex / php-imap

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well.
https://www.php-imap.com
MIT License
314 stars 147 forks source link

stream_socket_client(): unable to connect to ssl: //outlook.office365.com:993 (Network is unreachable) #434

Open sirsheyi opened 1 year ago

sirsheyi commented 1 year ago

When I run this code from my localhost, it works fine and I am able to retrieve mails.

$cm = new ClientManager(); $client = $cm->make([ 'host' => 'outlook.office365.com', 'port' => 993, 'encryption' => 'ssl', 'validate_cert' => true, 'username' => $settings['email'], 'password' => $access_token, 'protocol' => 'imap', 'authentication' => 'oauth' ]);

$client->connect();

However, when I run it from my server, I am constantly getting this error:


Warning: stream_socket_client(): unable to connect to ssl: //outlook.office365.com:993 (Network is unreachable) in /home/parcibej/grimaldi.parcelflow.io/vendor/webklex/php-imap/src/Connection/Protocols/Protocol.php on line 204
connection failed

Any help on how to resolve this please?

BroedersC commented 1 year ago

Hi @sirsheyi - It seems your hosting partner NameCheap is blocking outbound traffic on port 993 by default. I'd suggest you reach out to their CS to have it opened😄

There have been others with the same issue: https://forum.osticket.com/d/101827-problems-with-the-e-mail-setup/6