php - 通过 PHP IMAP 连接到 Exchange 服务器,Exchange 服务器对 UNSEEN 电子邮件使用什么标志?

标签 php imap exchange-server exchange-server-2010

我正在使用包含在 Barbushin 的方便小类中的 PHP IMAP 库:https://github.com/barbushin/php-imap

我开始针对我的 Gmail 帐户进行测试,该帐户将使用以下内容获取我的未读电子邮件。

$imap = new IMAP();
$unseen = $imap->searchMailbox('UNSEEN');

类中的函数执行以下操作:

/*
 *      ALL - return all mails matching the rest of the criteria
 *      ANSWERED - match mails with the \\ANSWERED flag set
 *      BCC "string" - match mails with "string" in the Bcc: field
 *      BEFORE "date" - match mails with Date: before "date"
 *      BODY "string" - match mails with "string" in the body of the mail
 *      CC "string" - match mails with "string" in the Cc: field
 *      DELETED - match deleted mails
 *      FLAGGED - match mails with the \\FLAGGED (sometimes referred to as Important or Urgent) flag set
 *      FROM "string" - match mails with "string" in the From: field
 *      KEYWORD "string" - match mails with "string" as a keyword
 *      NEW - match new mails
 *      OLD - match old mails
 *      ON "date" - match mails with Date: matching "date"
 *      RECENT - match mails with the \\RECENT flag set
 *      SEEN - match mails that have been read (the \\SEEN flag is set)
 *      SINCE "date" - match mails with Date: after "date"
 *      SUBJECT "string" - match mails with "string" in the Subject:
 *      TEXT "string" - match mails with text "string"
 *      TO "string" - match mails with "string" in the To:
 *      UNANSWERED - match mails that have not been answered
 *      UNDELETED - match mails that are not deleted
 *      UNFLAGGED - match mails that are not flagged
 *      UNKEYWORD "string" - match mails that do not have the keyword "string"
 *      UNSEEN - match mails which have not been read yet
 *
 * @return array Mails ids
 */
public function searchMailbox($criteria = 'ALL') {
    $mailsIds = imap_search($this->imapStream, $criteria, SE_UID, $this->serverEncoding);
    return $mailsIds ? $mailsIds : array();
}

只是一个方便的包装器 imap_search(); http://php.net/manual/en/function.imap-search.php

已通过 IMAP 成功连接到我的 Exchange 服务器,我现在可以执行以下操作:

$imap = new IMAP();
$unseen = $imap->searchMailbox('ALL');

这将在 Exchange 收件箱中正常检索所有电子邮件(根据我的连接)。

UNSEEN(如文档所述)在 Google Mail 上按预期工作,但在 Exchange 2010 上不按预期工作。ALL 在两者上都按预期工作。我想知道 Exchange 2010 是否使用了不同的标志? NEWUNREAD 也不起作用。我可以从这些 mailID 获得的返回详细信息不包含用于逆向工程的标志数组。

任何帮助将不胜感激:)

最佳答案

如果不起作用,则表明 Exchange 存在错误。 UNSEEN 搜索项对应于缺少 \Seen 关键字(消息标志),请参阅 RFC 3501, p. 52 .

关于php - 通过 PHP IMAP 连接到 Exchange 服务器,Exchange 服务器对 UNSEEN 电子邮件使用什么标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16561500/

相关文章:

c# - 使用别名地址过滤用户 - MS Graph

C# exchange server 获取 session 室预约列表

php - 在 Woocommerce 3+ 中检查产品价格是否含税

php - 在另一个命令中调用 Symfony 控制台命令并抑制输出

php - 管理注册网站 Cron 作业的最佳方式

PHP IMAP 交换问题

email - 为什么仍在使用 POP3 协议(protocol)?

go - 如何获取 IMAP 消息的可见/不可见状态

java - 适用于Android的Java EWS库

php - Paypal IPN - 获得+然后丢失数据?