php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45470 IMAP with Exchange doesn't work
Submitted: 2008-07-09 20:50 UTC Modified: 2008-07-14 20:31 UTC
From: kevin at icscomp dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.2.6 OS: Windows 2003 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kevin at icscomp dot com
New email:
PHP Version: OS:

 

 [2008-07-09 20:50 UTC] kevin at icscomp dot com
Description:
------------
When I run the PHP commands to try to retrieve the unread messages using
the imap_status command, I am finding that no data is being returned. 
Additionally, the data that is being returned is random numbers each
time I push the refresh button.  I would really like to see this issue
be fixed.  Thanks.

My code is below:


Here is the output


Help!


Reproduce code:
---------------
$mbox = imap_open("{mailserver:993/imap/ssl}", "domain/user","password",
OP_READONLY, 1) or die("can't connect: ".imap_last_error());
$imap_obj = imap_status($mbox, "{mail:993/imap/ssl}/INBOX", SA_UNSEEN);
var_dump($imap_obj);


Expected result:
----------------
I assume something like:

object(stdClass)#19 (1) { ["Unread"]=> int(5) } 



Actual result:
--------------
Output 1:
object(stdClass)#19 (1) { ["flags"]=> int(0) } 

Output 2:
object(stdClass)#19 (2) { ["flags"]=> int(26571976) ["uidnext"]=>
int(26649488) }

back and forth .... no other data is listed.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-10 08:18 UTC] jani@php.net
Shouldn't you be using same server name in both imap_open() and imap_status() ??
 [2008-07-10 13:22 UTC] kevin at icscomp dot com
I have tried using this as well:

imap_open("{mailserver:993/imap/ssl}/INBOX",
"domain/user","password",
OP_READONLY, 1) or die("can't connect: ".imap_last_error());
$imap_obj = imap_status($mbox, "{mail:993/imap/ssl}/INBOX", SA_UNSEEN);
var_dump($imap_obj);


Same result.  Any ideas?
 [2008-07-11 15:09 UTC] jani@php.net
It's just that Exhange + IMAP == not very good idea. It's not any PHP bug anyway, we just wrap around the UW Imap c-client lib, so you should complain to the author of it. But consider yourself warned: He'll say about same what I said above. :)
 [2008-07-11 16:18 UTC] kevin at icscomp dot com
Okay, well if the PHP component to check unread messages doesn't work on Exchange, is their an alternate PHP solution for doing this?
 [2008-07-14 20:31 UTC] kevin at icscomp dot com
Okay, well now I know this is legitimate.  

I have tried using imap_num_recent and imap_check and these functions return correct results.  Please address this.

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 19:01:37 2025 UTC