How to search inbox using zend mail
Posted
by
Bob Cavezza
on Stack Overflow
See other posts from Stack Overflow
or by Bob Cavezza
Published on 2010-12-31T22:45:31Z
Indexed on
2010/12/31
22:54 UTC
Read the original article
Hit count: 415
The following is a function from zend_mail_protocol_imap. i read that to search emails, I would want to override it using zend_mail_storage_imap (which is what I'm using now to grab email from gmail). I copy and pasted the following function into zend_mail_storage_imap, but I'm having issues with the params. I can't find documentation on what to use for the array $params. I initially thought it was the search term before reading it more thoroughly. I'm out of ideas. Here's the function...
/**
* do a search request
*
* This method is currently marked as internal as the API might change and is not
* safe if you don't take precautions.
*
* @internal
* @return array message ids
*/
public function search(array $params)
{
$response = $this->requestAndResponse('SEARCH', $params);
if (!$response) {
return $response;
}
foreach ($response as $ids) {
if ($ids[0] == 'SEARCH') {
array_shift($ids);
return $ids;
}
}
return array();
}
Initially I thought this would do the trick...
$storage = new Zend_Mail_Storage_Imap($imap);
$searchresults = $storage->search('search term');
But nope, I need to send the info in an array. Any ideas?
© Stack Overflow or respective owner