我使用PHP Zimbra并尝试通过搜索请求获取消息。我的要求是
$req = new \Zimbra\Mail\Request\Search();
$req->setQuery('Mail Delivery System in:inbox')
->setResultMode('IDS')
->setField('subject')
->setSearchTypes('message')
->setLimit(1000);我怎样才能得到回应?我没有找到任何像getRespone()之类的搜索方法。还是我的要求不对?
发布于 2022-09-09 11:00:35
密码
他们最近添加了一个文档部分,准确地显示了docs/usage.md中的用例。
<?php declare(strict_types=1);
require_once 'vendor/autoload.php';
use Zimbra\Mail\MailApi;
$query = 'in:inbox';
$api = new MailApi('https://zimbra.server/service/soap');
$api->authByAccountName($accountName, $password);
$response = $api->search($query, FALSE, 'message');
$messages = $response->getMessageHits(); //$messages contains the results功能
示例使用并在src/Mail/MailApi.php中定义的src/Mail/MailApi.php函数具有分页和其他内容所需的所有参数。
public function search(
?string $query = NULL,
?bool $inDumpster = NULL,
?string $searchTypes = NULL,
?string $groupBy = NULL,
?int $calItemExpandStart = NULL,
?int $calItemExpandEnd = NULL,
?bool $quick = NULL,
?SearchSortBy $sortBy = NULL,
?bool $includeTagDeleted = NULL,
?bool $includeTagMuted = NULL,
?string $taskStatus = NULL,
?string $fetch = NULL,
?bool $markRead = NULL,
?int $maxInlinedLength = NULL,
?bool $wantHtml = NULL,
?bool $needCanExpand = NULL,
?bool $neuterImages = NULL,
?WantRecipsSetting $wantRecipients = NULL,
?bool $prefetch = NULL,
?string $resultMode = NULL,
?bool $fullConversation = NULL,
?string $field = NULL,
?int $limit = NULL,
?int $offset = NULL,
array $headers = [],
?CalTZInfo $calTz = NULL,
?string $locale = NULL,
?CursorInfo $cursor = NULL,
?MsgContent $wantContent = NULL,
?bool $includeMemberOf = NULL,
?bool $warmup = NULL
): ?Message\SearchResponse查询语法
关于查询语法,请参阅正式的Zimbra文档
所描述的“搜索语言结构”是webmail使用、Rest和Soap (这个库所使用的)之间的一个通用标准。
https://stackoverflow.com/questions/66453385
复制相似问题