koreanbbque Posted April 24, 2017 Share Posted April 24, 2017 Been trying to get a script to parse an office365 inbox with no success. I've tried out stackoverflow / google search recommendations, but no luck <?php $user = 'user@mydomain.com'; $pass = 'fakepass'; $hostname = '{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX'; $m = imap_open($hostname, $user, $pass, NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI')); When using real creds in the above test script, I get the following error. Warning: imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX in /private/tmp/imap.php on line 5 PHP Notice: Unknown: Can not authenticate to IMAP server: AUTHENTICATE failed. (errflg=2) in Unknown on line 0 I've tried both php 5.6.30 and php 7.1.4 on CentOS 6.5 and on MacOSX. I've checked my SSL settings as well and they're all appear to be set properly. This has been driving me nuts for the last few days. If anyone knows what's going on here, it'd be greatly appreciated. Nick Link to comment Share on other sites More sharing options...
ginerjm Posted April 24, 2017 Share Posted April 24, 2017 just a stab here but my connection string does not have an 'imap' in it. $host = "{". $domain . ":993/ssl/novalidate-cert}"; $mailbox = imap_open($host.'INBOX', $incoming_email, $emlaccess); where domain is simply name.com, etc. incoming email is the mailbox name, ie, myname@domain.com emlaccess is the mailbox password. Link to comment Share on other sites More sharing options...
taquitosensei Posted April 24, 2017 Share Posted April 24, 2017 Been trying to get a script to parse an office365 inbox with no success. I've tried out stackoverflow / google search recommendations, but no luck <?php $user = 'user@mydomain.com'; $pass = 'fakepass'; $hostname = '{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX'; $m = imap_open($hostname, $user, $pass, NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI')); When using real creds in the above test script, I get the following error. Warning: imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX in /private/tmp/imap.php on line 5 PHP Notice: Unknown: Can not authenticate to IMAP server: AUTHENTICATE failed. (errflg=2) in Unknown on line 0 I've tried both php 5.6.30 and php 7.1.4 on CentOS 6.5 and on MacOSX. I've checked my SSL settings as well and they're all appear to be set properly. This has been driving me nuts for the last few days. If anyone knows what's going on here, it'd be greatly appreciated. Nick Try adding authuser=user@mydomain.com to the host Link to comment Share on other sites More sharing options...
koreanbbque Posted April 24, 2017 Author Share Posted April 24, 2017 Try adding authuser=user@mydomain.com to the host I tried that as well. It produces the same error. Thanks for replying though. I still haven't ruled out something weird on the server side. This is not a shared account (according to the sysadmin who's managing our account) so not sure what else there is to check on the server side settings. Link to comment Share on other sites More sharing options...
koreanbbque Posted April 24, 2017 Author Share Posted April 24, 2017 just a stab here but my connection string does not have an 'imap' in it. $host = "{". $domain . ":993/ssl/novalidate-cert}"; $mailbox = imap_open($host.'INBOX', $incoming_email, $emlaccess); where domain is simply name.com, etc. incoming email is the mailbox name, ie, myname@domain.com emlaccess is the mailbox password. Interesting, and this works for you? What version of PHP and OS are you on? If this is working for you, then I'm going to go back to my sysadmin and say this is an email server setting issue and not this script. Link to comment Share on other sites More sharing options...
ginerjm Posted April 24, 2017 Share Posted April 24, 2017 PHP 5.5.37 Linux 3.10.0-327 Link to comment Share on other sites More sharing options...
koreanbbque Posted April 24, 2017 Author Share Posted April 24, 2017 Btw, it turned out there is an internal whitelist that needed to be updated. Due to the fact this node is in AWS and it was recently relaunched, the new public IP was not whitelisted. Solution for us : associate elastic IP to node. Whitelist ElasticIP within Office365 system. Btw, since telnet to the port 993 from the affected host was still working, we did not initially think this was an IP whitelist issue. The PHP code posted above worked as it should. Thank you for everyone for chiming in. Nick Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.