Forum Discussion
Outlook IMAP in PHP
I'm trying to retrieve inbox mail using IMAP, but I'm encountering the following error. I've attached the code and error details below. Please advise.
$imapServer = "{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX";
$username = '*************';
$password = '*************'; // Use an App Password for security
$imapStream = imap_open($imapServer, $username, $password, OP_READONLY, 0, ['DISABLE_AUTHENTICATOR' => 'GSSAPI']);
I'm getting this error:
A PHP Error was encountered
Severity: Warning
Message: imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX
Filename: controllers/Cron_Controller.php
Line Number: 39
Backtrace:
File: C:\xampp73\htdocs\WPS2.0_2025_03_04_1847\application\controllers\Cron_Controller.php
Line: 39
Function: imap_open
File: C:\xampp73\htdocs\WPS2.0_2025_03_04_1847\index.php
Line: 348
Function: require_once
A PHP Error was encountered
Severity: Notice
Message: Unknown: LOGIN failed. (errflg=1)
Filename: Unknown
Line Number: 0
Backtrace
Thanks & Regards
Kumaresan
1 Reply
- OprahfreyIron Contributor
Try switching to OAuth 2.0 authentication, or just get on the Graph API