Search code examples
phpzend-frameworkgmailimapgmail-imap

How to use Gmail XLIST command with Zend Framework IMAP?


I am using the IMAP-module from Zend Framework to interact with Gmail.

But I need to implement to XLIST command (http://code.google.com/intl/nl-NL/apis/gmail/imap/#xlist) to get folder names. But I don't have any clue how to do this with Zend...

Is there anybody who can help me?

Thanks!


Solution

  • Use the requestAndResponse method to send arbitrary IMAP commands (from the Zend_Mail_Protocol_Imap class, not from the Zend_Mail_Storage_Imap class).

    $imap = new Zend_Mail_Protocol_Imap('imap.gmail.com', '993', true);
    // ... login with OAuth etc.
    $response = $imap->requestAndResponse('XLIST', $imap->escapeString('', '*'));