I'm using fmailbox to connect to exchange, to get the list messages to work, I had to change the preg_match line in listMessages() to this:
if (preg_match('#^\\s*\\*\\s+STATUS\\s+INBOX\\s+\\((.*)\\)$#', $line, $match)) {
pretty much the same thing, except that it's minus the "'s around INBOX.
btw, this is the debug output of the command:
Sending:
a0004 STATUS "INBOX" (MESSAGES)
Recieved:
* STATUS INBOX (MESSAGES 5)
a0004 OK STATUS completed.