Zend IMAP search and filters

2019-05-05 03:02发布

问题:

How do i make search using filters like in gmail. Like getting list of email with specific labels or list of mails from a specific email address. I couldn't able to find it in documentations.

Note:I use oAuth for authentication. I hope this has nothing to do with search.

回答1:

The labels on Gmail are in fact (from IMAP point of view) folders, so to get all emails with label you can just list e-mails in folder of this name.

To search you could use "undocumented" function search() (see Zend/Mail/Imap/Protocol.php), but see the method comment: This method is currently marked as internal as the API might change and is not safe if you don't take precautions. So you may rather use PHP's own imap_search() function.

See also Zend Framework feature request ZF-8858.